From nobody Sun Apr 28 09:33:07 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549427859363311.6948222086677; Tue, 5 Feb 2019 20:37:39 -0800 (PST) Received: from localhost ([127.0.0.1]:44905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grExk-0002NE-CC for importer@patchew.org; Tue, 05 Feb 2019 23:37:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grEw0-0001TS-91 for qemu-devel@nongnu.org; Tue, 05 Feb 2019 23:35:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grEvz-0007UA-F5 for qemu-devel@nongnu.org; Tue, 05 Feb 2019 23:35:40 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:34562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1grEvz-0007Jx-81 for qemu-devel@nongnu.org; Tue, 05 Feb 2019 23:35:39 -0500 Received: by mail-wm1-x334.google.com with SMTP id y185so825485wmd.1 for ; Tue, 05 Feb 2019 20:35:27 -0800 (PST) Received: from cloudburst.twiddle.net (host81-133-38-158.in-addr.btopenworld.com. [81.133.38.158]) by smtp.gmail.com with ESMTPSA id x186sm30255006wmg.41.2019.02.05.20.35.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 20:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lOehrnojtFNyYlkb98dSPwcNQ32zwCOQaPJmEznAG20=; b=cFsorDIDQy9xCON4z10OQInATs9wQOefsvd9V7lluX1ejPMK6mV2O+4wS9EJRmli/9 zQA/LCxObZ1+C/1XJyIdgvV5M28RaYFPmtrNB/I+Jt9oImGAShffTmHs2FTvmASUfyB/ 25+YlkhlhaQmtW+1iH6pScJftDPGHx6ANx9gYfGHk5A+8jZaHK3RhZjs5UfSOJ05yODx 0xWLm/iRmYOxMsIUpWKFu0hJbXGOheoIxUQN/jAlmTXswpH5pOhaomuNU8vkxdteLILE X7th+xJUwgGGzzfWH42Ioby+uqBhBlSFlIPSi+cTN3WLn6dISV2ju0WyQJI5UvFKU2O+ j5xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lOehrnojtFNyYlkb98dSPwcNQ32zwCOQaPJmEznAG20=; b=gFfRvJD4V/iKcjGvCTS0K9ntwwpfLqlIXR6wbN4Fz71j3KP7mr2S+dBkDlhApji1V3 MlnVPA8K2Eqbil/Kl65KrS2QRuXGNjh4c9jPaiAlzWbA/d9DP+Y3ldztxmy6cqkSeonQ qd7Vg0WyovtiHZ/JPTNhbN2Zk0vjRnJRbvAJqzn5D5hxPl89alWMHbK+GoY2NSHfh/oK J/1xJVzkc8RRmqvYB4vPnuKDua3CU+yLk6NUmQLeBlwmq5r/EdZBFFHNvcYRu2gB5OVn 9fAzMqy/pGoGx/IkwV/Or0OiJQaQEN3vK+v0B1hVjnWZLmTTMyr2/euBhL2ZFL8tuyrz KnmA== X-Gm-Message-State: AHQUAuY/frtqTeUW0GvjzVHPHHe0g3+oFunaozdUyU5OjUqXF6i6aU9Q aC45XJL9tW7P3TlaYZ3Kb4Fbl00SYvZAIQ== X-Google-Smtp-Source: AHgI3IZG38UWrp0+rTIDbS87jWKbSQVlSc7WQcACJn+eGSWmeGTS6NI17ROcZqw16viKjJmgPTN3Kg== X-Received: by 2002:a1c:7306:: with SMTP id d6mr1317243wmb.98.1549427726010; Tue, 05 Feb 2019 20:35:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2019 04:35:15 +0000 Message-Id: <20190206043516.11462-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190206043516.11462-1-richard.henderson@linaro.org> References: <20190206043516.11462-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 1/2] tcg: add early clober modifier in atomic16_cmpxchg on aarch64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Catherine Ho Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Catherine Ho Without this patch, gcc might up the Input/Output registers and cause unpredictable error. Fixes: 1ec182c33379 ("target/arm: Convert to HAVE_CMPXCHG128") Signed-off-by: Catherine Ho Message-Id: <1548838794-23757-1-git-send-email-catherine.hecx@gmail.com> Signed-off-by: Richard Henderson --- include/qemu/atomic128.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/atomic128.h b/include/qemu/atomic128.h index a6af22ff10..ddd0d55d31 100644 --- a/include/qemu/atomic128.h +++ b/include/qemu/atomic128.h @@ -68,7 +68,7 @@ static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128= cmp, Int128 new) "cbnz %w[tmp], 0b\n" "1:" : [mem] "+m"(*ptr), [tmp] "=3D&r"(tmp), - [oldl] "=3D&r"(oldl), [oldh] "=3Dr"(oldh) + [oldl] "=3D&r"(oldl), [oldh] "=3D&r"(oldh) : [cmpl] "r"(cmpl), [cmph] "r"(cmph), [newl] "r"(newl), [newh] "r"(newh) : "memory", "cc"); --=20 2.17.2 From nobody Sun Apr 28 09:33:07 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 154942785999676.57449744740848; Tue, 5 Feb 2019 20:37:39 -0800 (PST) Received: from localhost ([127.0.0.1]:44907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grExk-0002Oa-TM for importer@patchew.org; Tue, 05 Feb 2019 23:37:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grEvz-0001TR-Sm for qemu-devel@nongnu.org; Tue, 05 Feb 2019 23:35:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grEvy-0007Tl-Ru for qemu-devel@nongnu.org; Tue, 05 Feb 2019 23:35:39 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:54120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1grEvx-0007Mu-PZ for qemu-devel@nongnu.org; Tue, 05 Feb 2019 23:35:38 -0500 Received: by mail-wm1-x334.google.com with SMTP id d15so1064307wmb.3 for ; Tue, 05 Feb 2019 20:35:28 -0800 (PST) Received: from cloudburst.twiddle.net (host81-133-38-158.in-addr.btopenworld.com. [81.133.38.158]) by smtp.gmail.com with ESMTPSA id x186sm30255006wmg.41.2019.02.05.20.35.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 20:35:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G7xyjQ5I4ikKCmR0R0iMN0Nm7+eGJ4RmAdhai8noOjI=; b=xEWay8Z1U/5g45is3Owz3eQm4xAI2x5Q3T7nhngx3bOY/2ywt9OMyqe+0VriYe9Cji DOkJsLPaDs+EhZvLwkL57hluMAg3vAji6emMNMsvXYwORv+/SZHH2uuQF9KNo9XrQ47Q kuPBY6rXyfe31FAsB/Cdyjgtqku3KEp4/zJAfHh5f4cZx4IQ4j2RWjcqGB1YkbzqrKO3 mh7lJ+1kedmoBgoNVzSHS5pGjuY6CWL293uvP1ihin1qwjD2eyFrU+qwPX4IiVk8+DYl nHJ/fXYTdqF361sEF2aYuPq220uE1acSVfAWXTIQJlk4nnr0zGJO/hgRZKdMCJvPhkxY WfkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G7xyjQ5I4ikKCmR0R0iMN0Nm7+eGJ4RmAdhai8noOjI=; b=Au62MURepDJpztBUtqKdWlCARusPzoE5BhsTA5pS8+UKsK7xubFhXAhfVnYKjOJWR+ RJQwpnlpeR7H8rCY886fGbMv98Cx77vHMgozwnEMZlgjEoms9RcI5MCop91dqcmqBMKf E4fLGuc9qBXLamMvde+CG5kGcbrYDIv1zL02SLoJKuY7gWrjl/zzwW3qwdU2/rQDF+vU 1kDVKyIZdsjW1TtnPes+Vau92xNiPMTIA4caxVFGNn2yd0sltL54ZJuiJPkHVZkpZmV4 ZOGeZ3+H1P9ejSAbPDeFqbARGCKXVvnelSuUmzb5dAVHI9I9kb314XFK88p9HMMvno8j mcLg== X-Gm-Message-State: AHQUAuasnjL+6KsarcyIynZpJq97Zw+ZNWfDryn9n/nsY0K3wGdTGsJ6 Rvj8EB47QPT245OSVERJ0IGRRfba8pBeBg== X-Google-Smtp-Source: AHgI3Ib3N73gPfxSF+hzBIWjcsrMX7lGB9Pay8BAThbEGqXBpTVIx/iL5s1xJ1+UtEM75GxyaG/TqA== X-Received: by 2002:a1c:2088:: with SMTP id g130mr1332485wmg.122.1549427727420; Tue, 05 Feb 2019 20:35:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2019 04:35:16 +0000 Message-Id: <20190206043516.11462-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190206043516.11462-1-richard.henderson@linaro.org> References: <20190206043516.11462-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 2/2] accel/tcg: Consider cluster index in tb_lookup__cpu_state() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell In commit f7b78602fdc6c6e4be we added the CPU cluster number to the cflags field of the TB hash; this included adding it to the value kept in tb->cflags, since we pass that field directly into the hash calculation in some places. Unfortunately we forgot to check whether other parts of the code were doing comparisons against tb->cflags that would need to be updated. It turns out that there is exactly one such place: the tb_lookup__cpu_state() function checks whether the TB it has found in the tb_jmp_cache has a tb->cflags matching the cf_mask that is passed in. The tb->cflags has the cluster_index in it but the cf_mask does not. Hoist the "add cluster index to the cf_mask" code up from tb_htable_lookup() to tb_lookup__cpu_state() so it can be considered in the "did this TB match in the jmp cache" condition, as well as when we do the full hash lookup by physical PC, flags, etc. (tb_htable_lookup() is only called from tb_lookup__cpu_state(), so this change doesn't require any further knock-on changes.) Fixes: f7b78602fdc6c6e4be ("accel/tcg: Add cluster number to TCG TB hash") Tested-by: Cleber Rosa Tested-by: Mark Cave-Ayland Reported-by: Howard Spoelstra Reported-by: Cleber Rosa Signed-off-by: Peter Maydell Message-Id: <20190205151810.571-1-peter.maydell@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- include/exec/tb-lookup.h | 4 ++++ accel/tcg/cpu-exec.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/exec/tb-lookup.h b/include/exec/tb-lookup.h index 492cb68289..26921b6daf 100644 --- a/include/exec/tb-lookup.h +++ b/include/exec/tb-lookup.h @@ -28,6 +28,10 @@ tb_lookup__cpu_state(CPUState *cpu, target_ulong *pc, ta= rget_ulong *cs_base, cpu_get_tb_cpu_state(env, pc, cs_base, flags); hash =3D tb_jmp_cache_hash_func(*pc); tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[hash]); + + cf_mask &=3D ~CF_CLUSTER_MASK; + cf_mask |=3D cpu->cluster_index << CF_CLUSTER_SHIFT; + if (likely(tb && tb->pc =3D=3D *pc && tb->cs_base =3D=3D *cs_base && diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 7cf1292546..60d87d5a19 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -325,9 +325,6 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, targe= t_ulong pc, struct tb_desc desc; uint32_t h; =20 - cf_mask &=3D ~CF_CLUSTER_MASK; - cf_mask |=3D cpu->cluster_index << CF_CLUSTER_SHIFT; - desc.env =3D (CPUArchState *)cpu->env_ptr; desc.cs_base =3D cs_base; desc.flags =3D flags; --=20 2.17.2