From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484617140522.3206779027244; Thu, 2 Mar 2017 11:56:57 -0800 (PST) Received: from localhost ([::1]:54277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWqN-0001fL-VM for importer@patchew.org; Thu, 02 Mar 2017 14:56:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnG-0007xC-Nt for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnE-0002Sv-T2 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:42 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:34717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnE-0002Rr-Mc for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:40 -0500 Received: by mail-wm0-x233.google.com with SMTP id 196so4752098wmm.1 for ; Thu, 02 Mar 2017 11:53:38 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d6sm28357217wmd.6.2017.03.02.11.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:34 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 295283E02AD; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=UhmLm1oe/5yjFnYNjzVo/Ap2UjT2ZyYmvQDSrziyhVc=; b=Hdj/xZXZODGUIKQLZbuZ0dRNIfkVlwmyr6MIpjHhOYgZx7FNTYv0XXLyDlGyx4PyXo UBhqYgFbEg4gVZrhrBu8d1465Qbo0s6WQJAXnx9f643caBRFG7yukjJSFIv9+qzb36uE TT/bMRvJy4c9VM525ZcGINitDCPcNEjePfYCM= 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:mime-version:content-transfer-encoding; bh=UhmLm1oe/5yjFnYNjzVo/Ap2UjT2ZyYmvQDSrziyhVc=; b=EIDW+TX1ZWQBun0j/z93x9w9DYyXPXHG7WGDFkgMzNOT71O0HV9aEqv2amjajrZbuK mV0bcr2jKI3wx7IIvTWKueLn5V/XB7yEay705icI7nAhlkw4AIBUsMzeUf+QdHsQbVVm 3YTS69jKm3rnlY6ZmUAu6CCiFpeXHr3O5QBZGGTxUu7TodkD/VGcOq57wjNnl18noQLQ eYx+sY5BP/RuJrcUrIu2ulx+ij+Tc6B6QD03e9p9qV2GZdS7djh4012WxJVXaD03yoqn bIAB/hZfHb/aRwhHE5uXsBcvfgYMyEmE4UG1My6+Ddj5HeWntLOZx9mnF7ZA1C63dmLt Cyzg== X-Gm-Message-State: AMke39madWBszc3tNU7lCAxO4MsmyRkjmzEFQG+PLBIZAcvza4Obe0Yc2FCzLhWABrTDW1sB X-Received: by 10.28.152.212 with SMTP id a203mr4907wme.7.1488484417940; Thu, 02 Mar 2017 11:53:37 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:27 +0000 Message-Id: <20170302195337.31558-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::233 Subject: [Qemu-devel] [PATCH v2 01/11] vl/cpus: be smarter with icount and MTTCG 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, Peter Crosthwaite , a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The sense of the test was inverted. Make it simple, if icount is enabled then we disabled MTTCG by default. If the user tries to force MTTCG upon us then we tell them "no". Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- cpus.c | 7 +++---- vl.c | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cpus.c b/cpus.c index 8200ac6b75..e9aab9f70f 100644 --- a/cpus.c +++ b/cpus.c @@ -185,10 +185,7 @@ static bool check_tcg_memory_orders_compatible(void) =20 static bool default_mttcg_enabled(void) { - QemuOpts *icount_opts =3D qemu_find_opts_singleton("icount"); - const char *rr =3D qemu_opt_get(icount_opts, "rr"); - - if (rr || TCG_OVERSIZED_GUEST) { + if (use_icount || TCG_OVERSIZED_GUEST) { return false; } else { #ifdef TARGET_SUPPORTS_MTTCG @@ -206,6 +203,8 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) if (strcmp(t, "multi") =3D=3D 0) { if (TCG_OVERSIZED_GUEST) { error_setg(errp, "No MTTCG when guest word size > hosts"); + } else if (use_icount) { + error_setg(errp, "No MTTCG when icount is enabled"); } else { if (!check_tcg_memory_orders_compatible()) { error_report("Guest expects a stronger memory ordering= " diff --git a/vl.c b/vl.c index e10a27bdd6..bbbf1baadf 100644 --- a/vl.c +++ b/vl.c @@ -4025,8 +4025,6 @@ int main(int argc, char **argv, char **envp) =20 replay_configure(icount_opts); =20 - qemu_tcg_configure(accel_opts, &error_fatal); - machine_class =3D select_machine(); =20 set_memory_options(&ram_slots, &maxram_size, machine_class); @@ -4393,14 +4391,13 @@ int main(int argc, char **argv, char **envp) if (!tcg_enabled()) { error_report("-icount is not allowed with hardware virtualizat= ion"); exit(1); - } else if (qemu_tcg_mttcg_enabled()) { - error_report("-icount does not currently work with MTTCG"); - exit(1); } configure_icount(icount_opts, &error_abort); qemu_opts_del(icount_opts); } =20 + qemu_tcg_configure(accel_opts, &error_fatal); + if (default_net) { QemuOptsList *net =3D qemu_find_opts("net"); qemu_opts_set(net, NULL, "type", "nic", &error_abort); --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484510152719.4740441460684; Thu, 2 Mar 2017 11:55:10 -0800 (PST) Received: from localhost ([::1]:54265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWod-0000AK-Ux for importer@patchew.org; Thu, 02 Mar 2017 14:55:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnG-0007xG-Pg for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnE-0002SZ-6t for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:42 -0500 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:36817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnE-0002S3-0u for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:40 -0500 Received: by mail-wr0-x22c.google.com with SMTP id u108so60198274wrb.3 for ; Thu, 02 Mar 2017 11:53:39 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l138sm6162943wmd.7.2017.03.02.11.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:35 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 3A3973E02BA; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=9a9JTP3SAdHA9a0d9ouXMFeBL4dZImMU0iZs9z8BtU8=; b=ZczSzHENA5HRopKrX7csMGWPn2xGjz1lYrTY27KIVLPWkaXpJp5tNBCS1oDLZzWcUV ZSmgx1neaoHLbNNMDurD5t0NJw9IypxjIpODK66/0cXBE18vq/arUP7t03FT1yuK33SV dPSMswDGDSAw3uAxf1ER/ghmYBLe04XbybPlk= 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:mime-version:content-transfer-encoding; bh=9a9JTP3SAdHA9a0d9ouXMFeBL4dZImMU0iZs9z8BtU8=; b=oWZQCIG07dI/H78CGDwdDeOq5/oUQ2l8xEaStheKUyunl4GpVBzj1C36wvZdQSZcRE 1OL1aKKDz8lvWJs7g2yQ/8e6MF7E3LQxAD48d9Tp9JE533zUGkGs3vgojnlHGJrDxN1a BLyZbiG9dmWUQ8SF0qMrokqMJHZoaHeMW1jdiD37L1Y/K2H0nYrq2tPSGSCkaU9ddsNl 8lIRgxNNSLX/E+FmR3KW/J9FqA4ySAJqWms7viiPbRC/vEZUCPDzzPdr6d+5wYKSPY2Y CY1Ac4CrvplJilae2a6PL6aaBWzN2zJmD6OeTmEXAVYEK75/irCc+ic4WwXQHVKCjTTL 7cbA== X-Gm-Message-State: AMke39nmy5F0ZXcQOvhxfaMXhc1eoAj6uHHaqjsz7J7pSqCjgy1whSTD0jjdExuNYI4APbvK X-Received: by 10.223.164.140 with SMTP id g12mr13100054wrb.87.1488484418826; Thu, 02 Mar 2017 11:53:38 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:28 +0000 Message-Id: <20170302195337.31558-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22c Subject: [Qemu-devel] [PATCH v2 02/11] target/i386/cpu.h: declare TCG_GUEST_DEFAULT_MO 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: mttcg@listserver.greensocs.com, Eduardo Habkost , nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 This suppresses the incorrect warning when forcing MTTCG for x86 guests on x86 hosts. A future patch will still warn when TARGET_SUPPORT_MTTCG hasn't been defined for the guest (which is still pending for x86). Reported-by: Paolo Bonzini Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Acked-by: Eduardo Habkost Reviewed-by: Eduardo Habkost --- target/i386/cpu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 12a39d590f..ecdd3bbc2a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -30,6 +30,9 @@ #define TARGET_LONG_BITS 32 #endif =20 +/* The x86 has a strong memory model with some store-after-load re-orderin= g */ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) + /* Maximum instruction code size */ #define TARGET_MAX_INSN_SIZE 16 =20 --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484585519118.01121198189662; Thu, 2 Mar 2017 11:56:25 -0800 (PST) Received: from localhost ([::1]:54274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWpr-0001Eb-Am for importer@patchew.org; Thu, 02 Mar 2017 14:56:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnG-0007xD-O1 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnF-0002T2-F9 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:42 -0500 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:37536) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnF-0002Sh-8O for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:41 -0500 Received: by mail-wm0-x235.google.com with SMTP id n11so132165wma.0 for ; Thu, 02 Mar 2017 11:53:41 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o143sm2097wmd.3.2017.03.02.11.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:37 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4BAD63E02E1; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=HBbLqHvQC5yHtS/+IDR28AnQ1+6F5Z4yhDyaU3w2t3M=; b=SjXqhkz+mmRskwCPE3wnOMquY1D4ihtgbfvIgGbubZMeaXciIanIcnyM1lFJtEtRPR 3Als6nfYLASC/9yxF4EVJMbTyghZ9R4htoJ9OzVosYb21b2Ej0crjJ6cpCZrp/cMYIjv 1Gb7E9Q844qiFefI2HYigUKcyIIrDTND/9/m0= 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:mime-version:content-transfer-encoding; bh=HBbLqHvQC5yHtS/+IDR28AnQ1+6F5Z4yhDyaU3w2t3M=; b=OoP5yvYObJBoqoaQcxCHI5y+KgVFZFUw48lkCBKHI6jksJKWw0JeiXmTugSh0Cemwz YWYfEI4b8mx+LVWIbMZS6Uh1tGXkvlH6SeHr657iX6trPsNyx20K8VjNEch8lPC6lZhZ 6NjIKK/rcoW8dHpKzCUHFhXA5wyk0xLg8XC/iT6VKXAjhSHom6tb3jOhq8iPgGyj2z/A 3HK8vMQgyNRiG9FHN81MJ8oMzFhAijIUiAzBrE1Bs32iKP/XI0UE05/5YUKQMQIfpfJq IXC3kJfqsknTlkZeRGEWCm5Bth+zU6QFZkIBEBdvKhXD+7cAmRFh8XvJU2OnsceqIgb/ aqQg== X-Gm-Message-State: AMke39mJXQDiNZ94MjsQuGJbLOwie9NBaoZLnTICMuxuAHvRmIGYfBuE7tNadIedfg+11GQf X-Received: by 10.28.130.207 with SMTP id e198mr27459wmd.4.1488484420100; Thu, 02 Mar 2017 11:53:40 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:29 +0000 Message-Id: <20170302195337.31558-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 Subject: [Qemu-devel] [PATCH v2 03/11] cpus.c: add additional error_report when !TARGET_SUPPORT_MTTCG 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, Peter Crosthwaite , a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 While we may fail the memory ordering check later that can be confusing. So in cases where TARGET_SUPPORT_MTTCG has yet to be defined we should say so specifically. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- cpus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpus.c b/cpus.c index e9aab9f70f..2459f564ea 100644 --- a/cpus.c +++ b/cpus.c @@ -206,6 +206,10 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) } else if (use_icount) { error_setg(errp, "No MTTCG when icount is enabled"); } else { +#ifndef TARGET_SUPPORT_MTTCG + error_report("Guest not yet converted to MTTCG - " + "you may get unexpected results"); +#endif if (!check_tcg_memory_orders_compatible()) { error_report("Guest expects a stronger memory ordering= " "than the host provides"); --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484726372484.7318028740666; Thu, 2 Mar 2017 11:58:46 -0800 (PST) Received: from localhost ([::1]:54288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWs7-0003Jv-6U for importer@patchew.org; Thu, 02 Mar 2017 14:58:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnH-0007xW-7Z for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnG-0002TI-C0 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:43 -0500 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:34511) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnG-0002T6-5f for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:42 -0500 Received: by mail-wr0-x234.google.com with SMTP id l37so60262185wrc.1 for ; Thu, 02 Mar 2017 11:53:41 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 136sm2800020wmg.12.2017.03.02.11.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:37 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 5DE2E3E04B2; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=DDm08/obXFO5/zyPEDyy5yaU4fu9phkTVhZl5s7VrQo=; b=ZUBgqa+wN2Ylo+cpvaj00T8VEaiv3qbYSsu8J0VbDw0GtxkzYyE56zol9yDDqtF8N6 zTbNlsfBXxAWR7dE518gWcYSiZcg2pcKX2hEPDpnWpAYKQJTXJIwbDCW7pr6H/wau73r h1HZPtYXcCri2m//FDTQeyAHR05jkNRlyN0GU= 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:mime-version:content-transfer-encoding; bh=DDm08/obXFO5/zyPEDyy5yaU4fu9phkTVhZl5s7VrQo=; b=pfTmSqujpaFTD8B12nR1yEq7i14pZK8omTjgkqdSk6j0+dU4iQlcxU3HGObSKH1KgO Dr/qKygzZOWgqi7HV3FsNMxXIiAXs8P0VjN0yMVmKbbp/rx2H1CxzedWQxmIrlGqtfJO I9AmOc5oLUtj3Yf8LjJZPPDRQglezfkxZ/bJ+knO41dUkUQ1aj3i1ceM2rSoACML5/hl Md9XxSqtIh5c92CDXz47b9Lexc64U3S5KzQ+jLiRpWjP5RGL9oQJWlxdp7GXI8Keu0mG w8PQFoECMarTw59tmbXWH/u8HZmEvJ+UW4fFR8hypa4JBfzrW1Almkr6661zcE7wlohY CkkQ== X-Gm-Message-State: AMke39mGC9udIFl3MU6RfgODtS57xr1h8UIErer9+QWHH4fdAb1GEsAh7XvpxGmY+m+/Wdme X-Received: by 10.223.173.199 with SMTP id w65mr13961566wrc.125.1488484420946; Thu, 02 Mar 2017 11:53:40 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:30 +0000 Message-Id: <20170302195337.31558-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PATCH v2 04/11] translate: downgrade IRQ BQL asserts to tcg_debug_assert 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, Peter Crosthwaite , a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 While on MTTCG hosts it is very important that updates to cpu->interrupt_request are protected by the BQL not all guests have been converted to the correct locking yet. As a result we are seeing breaking on non-MTTCG enabled guests in production builds. The locking in the guests needs to be fixed but while running single threaded they will continue to work. By moving the asserts to tcg_debug_asserts() they will still be useful during conversion work (much like the existing assert_memory_lock/assert_tb_lock asserts). Signed-off-by: Alex Benn=C3=A9e --- translate-all.c | 2 +- translate-common.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/translate-all.c b/translate-all.c index 9bac061c9b..7ee273410d 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1928,7 +1928,7 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_= fprintf) =20 void cpu_interrupt(CPUState *cpu, int mask) { - g_assert(qemu_mutex_iothread_locked()); + tcg_debug_assert(qemu_mutex_iothread_locked()); cpu->interrupt_request |=3D mask; cpu->tcg_exit_req =3D 1; } diff --git a/translate-common.c b/translate-common.c index d504dd0d33..24e05c077a 100644 --- a/translate-common.c +++ b/translate-common.c @@ -22,6 +22,7 @@ #include "qom/cpu.h" #include "sysemu/cpus.h" #include "qemu/main-loop.h" +#include "tcg.h" =20 uintptr_t qemu_real_host_page_size; intptr_t qemu_real_host_page_mask; @@ -31,7 +32,7 @@ intptr_t qemu_real_host_page_mask; static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; - g_assert(qemu_mutex_iothread_locked()); + tcg_debug_assert(qemu_mutex_iothread_locked()); =20 old_mask =3D cpu->interrupt_request; cpu->interrupt_request |=3D mask; --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484479714577.1232722010702; Thu, 2 Mar 2017 11:54:39 -0800 (PST) Received: from localhost ([::1]:54262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWoA-00085Q-H8 for importer@patchew.org; Thu, 02 Mar 2017 14:54:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnH-0007xw-Va for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnH-0002Tn-7N for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:44 -0500 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:33656) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnH-0002TM-1M for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:43 -0500 Received: by mail-wm0-x22e.google.com with SMTP id i17so4774107wmf.0 for ; Thu, 02 Mar 2017 11:53:42 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 136sm12484085wms.32.2017.03.02.11.53.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:38 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 6F0283E05DA; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=hvfEOJGYSnY5OpoSB8FY0H2tXO8IKjK4RW9UAyxCVuI=; b=DZqFy2O1XUjOlQH7L7iBfW83GcGZj71wrNVaSMIu5M4cp5jzjb1PLujS+X15ZR3ufV Sgxhh6dY+c+LMJGXbK+fGUJyJ9B8B+I1mga3TpsEa3i5P8RfANuTCg9nKXL/GwHN+kD9 juQmzg/KdQ5QpJsaRfR5kKWPQMXuoNwYAcVb0= 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:mime-version:content-transfer-encoding; bh=hvfEOJGYSnY5OpoSB8FY0H2tXO8IKjK4RW9UAyxCVuI=; b=Mk0f7pwmpaIAMw1te+nhAqsv3Z/3di5zYgBQgsm2ooca1RIL8LJDYdXFNbA3zr9EXL pf6pjhHjKhdKn/81LhyFzV3jsPcFJX6gGAJRXwfJKE8RWCuJQ3Y3Ll5Z8czZOp6quQka 5oQ8QJoZUau7x4/aHcTSUFXw7lXd0YNM+AT9MFao/MkW1q18i7tGp7/KXKxa8c9scelz lBqZds2sFHBn8u26FX96HHdrlzgD4O3N2QzKorzDlOqsiyFa4HmlLCWoxwGlQC59y1Tg sicsOq0p3/gzdo6Eu1kH7xZvJ+g2+viQ2e3aIwhpgkH/VLTwxBmvBLJUhXNbK6ACxShH BtaQ== X-Gm-Message-State: AMke39ktSfYyK+03x3uJwSG6SClWH7RPg7SoGhI3iq9nE3Hg8+wLD6tG+OHI+M+ZgYdCiVHh X-Received: by 10.28.211.200 with SMTP id k191mr9208630wmg.137.1488484421787; Thu, 02 Mar 2017 11:53:41 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:31 +0000 Message-Id: <20170302195337.31558-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22e Subject: [Qemu-devel] [PATCH v2 05/11] translate-all: exit cpu_restore_state early if translating 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, Peter Crosthwaite , a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The translation code uses cpu_ld*_code which can trigger a tlb_fill which if it fails will attempt a fault resolution. This never works during translation as the TB being generated hasn't been added yet. However with the new locking regime we end up double locking the tb_lock(). As the tcg_ctx.cpu is only set during translation we use this to short circuit the restore code and return with a fail. Most front-ends seem to ignore the pass/fail result anyway but tolerate not having the cpu environment updated. This is arguably ugly but will do for now. Signed-off-by: Alex Benn=C3=A9e --- translate-all.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/translate-all.c b/translate-all.c index 7ee273410d..956d54b882 100644 --- a/translate-all.c +++ b/translate-all.c @@ -333,6 +333,13 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retadd= r) TranslationBlock *tb; bool r =3D false; =20 + /* Don't attempt to restore state if we are translating already */ + if (tcg_ctx.cpu =3D=3D cpu) { + qemu_log_mask(LOG_UNIMP, "Attempt to resolve CPU state @ 0x%" PRIx= PTR + " while translating\n", retaddr); + return r; + } + tb_lock(); tb =3D tb_find_pc(retaddr); if (tb) { --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484693036774.4297641439401; Thu, 2 Mar 2017 11:58:13 -0800 (PST) Received: from localhost ([::1]:54285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWrZ-0002tA-TQ for importer@patchew.org; Thu, 02 Mar 2017 14:58:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnJ-0007zC-Ne for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnI-0002V2-EC for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:45 -0500 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:38724) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnI-0002U0-90 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:44 -0500 Received: by mail-wm0-x229.google.com with SMTP id t193so101595wmt.1 for ; Thu, 02 Mar 2017 11:53:44 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x1sm12049681wrd.63.2017.03.02.11.53.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:38 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 8451E3E085C; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=zed5cDojziza6smNZPOlbNc5pdgytzhPnd3NkICYVXg=; b=X8E0u/3LYO10pnhcI9zn3DY6kYlB9IC/UKS/dr7AhrvA8rLFqssTTrtOM2rslxSzT8 bqh1Klcl7kqnHxN/qkIhkgc12Bz5tu27tsxtQpLZ6d64laDo5OqQbsrHGKLjuqBt/c3n w1L+61WlUtbCj6gLaSo9VDKULaB3S/Oph8XPE= 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:mime-version:content-transfer-encoding; bh=zed5cDojziza6smNZPOlbNc5pdgytzhPnd3NkICYVXg=; b=b7ROWYTw6vPT9tJs6i7GKQXJ+Ye1j0X/LYTbFka3Qn5ioUhcsXOUkeGH++yr1n39Fl Prkgt3JiblSNUQe9A2HcYxKs/sEJXpJOkMrKFznY8hCriT4SA0ehpyH5IxR+N/ZRaFhA cS7gxnqcISU+EjluxNS9dHGXt52PhzNi5qa3JZcJCQIc9JT5oehRUDACby0HNb1sOX7W 3+XsXrt4AgFZpgwne8GSgH2PJG9jrDarsyGJ2MHFS55sIhpXwE7+SPrcHPDe2LH8hjP3 QH56x71kiM1gSdxuIPwLQCNLNo2kaQ1uoxiWwW7CgvDxciNNxd3Ojky83g/vVTYLERC+ 0HKw== X-Gm-Message-State: AMke39lYDUGaUnVz7gbq56BEJ5kr1OkOS98nHfvxka9+mjFgYJnULd48NKLpAxEWcIj7TTs/ X-Received: by 10.28.100.193 with SMTP id y184mr28765wmb.2.1488484423077; Thu, 02 Mar 2017 11:53:43 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:32 +0000 Message-Id: <20170302195337.31558-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::229 Subject: [Qemu-devel] [PATCH v2 06/11] sparc/sparc64: grab BQL before calling cpu_check_irqs 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, Mark Cave-Ayland , a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Artyom Tarasenko , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 IRQ modification is part of device emulation and should be done while the BQL is held to prevent races when MTTCG is enabled. This adds assertions in the hw emulation layer and wraps the calls from helpers in the BQL. Reported-by: Mark Cave-Ayland Signed-off-by: Alex Benn=C3=A9e --- hw/sparc/sun4m.c | 3 +++ hw/sparc64/sparc64.c | 3 +++ target/sparc/int64_helper.c | 3 +++ target/sparc/win_helper.c | 11 +++++++++++ 4 files changed, 20 insertions(+) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 61416a6426..873cd7df9a 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -142,6 +142,9 @@ void cpu_check_irqs(CPUSPARCState *env) { CPUState *cs; =20 + /* We should be holding the BQL before we mess with IRQs */ + g_assert(qemu_mutex_iothread_locked()); + if (env->pil_in && (env->interrupt_index =3D=3D 0 || (env->interrupt_index & ~15) =3D=3D TT_EXTINT)) { unsigned int i; diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index b3d219c769..4e4fdab065 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -55,6 +55,9 @@ void cpu_check_irqs(CPUSPARCState *env) uint32_t pil =3D env->pil_in | (env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER)); =20 + /* We should be holding the BQL before we mess with IRQs */ + g_assert(qemu_mutex_iothread_locked()); + /* TT_IVEC has a higher priority (16) than TT_EXTINT (31..17) */ if (env->ivec_status & 0x20) { return; diff --git a/target/sparc/int64_helper.c b/target/sparc/int64_helper.c index 605747c93c..f942973c22 100644 --- a/target/sparc/int64_helper.c +++ b/target/sparc/int64_helper.c @@ -18,6 +18,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "exec/log.h" @@ -208,7 +209,9 @@ static bool do_modify_softint(CPUSPARCState *env, uint3= 2_t value) env->softint =3D value; #if !defined(CONFIG_USER_ONLY) if (cpu_interrupts_enabled(env)) { + qemu_mutex_lock_iothread(); cpu_check_irqs(env); + qemu_mutex_unlock_iothread(); } #endif return true; diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c index 71b3dd37e8..b387b026d8 100644 --- a/target/sparc/win_helper.c +++ b/target/sparc/win_helper.c @@ -18,6 +18,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" @@ -86,7 +87,9 @@ void cpu_put_psr(CPUSPARCState *env, target_ulong val) { cpu_put_psr_raw(env, val); #if ((!defined(TARGET_SPARC64)) && !defined(CONFIG_USER_ONLY)) + qemu_mutex_lock_iothread(); cpu_check_irqs(env); + qemu_mutex_unlock_iothread(); #endif } =20 @@ -368,7 +371,9 @@ void helper_wrpstate(CPUSPARCState *env, target_ulong n= ew_state) =20 #if !defined(CONFIG_USER_ONLY) if (cpu_interrupts_enabled(env)) { + qemu_mutex_lock_iothread(); cpu_check_irqs(env); + qemu_mutex_unlock_iothread(); } #endif } @@ -381,7 +386,9 @@ void helper_wrpil(CPUSPARCState *env, target_ulong new_= pil) env->psrpil =3D new_pil; =20 if (cpu_interrupts_enabled(env)) { + qemu_mutex_lock_iothread(); cpu_check_irqs(env); + qemu_mutex_unlock_iothread(); } #endif } @@ -408,7 +415,9 @@ void helper_done(CPUSPARCState *env) =20 #if !defined(CONFIG_USER_ONLY) if (cpu_interrupts_enabled(env)) { + qemu_mutex_lock_iothread(); cpu_check_irqs(env); + qemu_mutex_unlock_iothread(); } #endif } @@ -435,7 +444,9 @@ void helper_retry(CPUSPARCState *env) =20 #if !defined(CONFIG_USER_ONLY) if (cpu_interrupts_enabled(env)) { + qemu_mutex_lock_iothread(); cpu_check_irqs(env); + qemu_mutex_unlock_iothread(); } #endif } --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484836612931.257746525944; Thu, 2 Mar 2017 12:00:36 -0800 (PST) Received: from localhost ([::1]:54296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWtv-0004lx-Gj for importer@patchew.org; Thu, 02 Mar 2017 15:00:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnK-000813-DN for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnJ-0002Vf-ET for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:46 -0500 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:37552) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnJ-0002V8-8A for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:45 -0500 Received: by mail-wm0-x22b.google.com with SMTP id n11so133207wma.0 for ; Thu, 02 Mar 2017 11:53:45 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b17sm12467929wma.33.2017.03.02.11.53.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:40 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 94C4D3E08E6; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=0/mBL8YEDIrXOvgwP6BHyMKtW3bqPjUnWf8pMW7K7m4=; b=Nk4xmTwqm+1x0sSL936fCCvil4qXnAO/weaY9CoPs104ePqe1SzevA/YflhSkmeiHb KGUo0U48tw2r0x1dy1mgWdhb1qIaiGobs5S5tyXbWej0szUHzkL6Li7h9IJv6hSuh3BD 8cQ3yUpNsELYG8qgKA0ReIcq8pnh1vLealBNg= 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:mime-version:content-transfer-encoding; bh=0/mBL8YEDIrXOvgwP6BHyMKtW3bqPjUnWf8pMW7K7m4=; b=oc4T29e7MM+yirctBsoHWb00hm46g9PNGCcCXu+KB6CKVcKn+aOF/L6BwcLDNl6xh3 9vs7Ht8//SsvFeQREq9675EEnAQWrLQRjz/utwdq8+NQwC5x4Ts3Bim3QVXinNIU709S 491uZ4OF7hfNhCjBLFNu0Qa1BaU5cPjSQOFVfSmMobjliCFYigxuT7GkG7R0K+l9yXm3 MUb7bqkUzo7Bm1CpS8yQEUuAzgOOKBeVaUfedl4gWsQkKSu5jjxDuVwCsxW3y2rasusu jQ2ApJcrC2WWQUxOFQ+Tx0wVVdtT7Gp+jMznVDesGHkPP69YRjU0e3reacSbYNWhx6l7 EHaA== X-Gm-Message-State: AMke39lu4q6FBwDvkaPaMXfM1gGlUJrHHMONpI9pmUtpffS+5Q119WjLTW076eoUHlCJR07C X-Received: by 10.28.56.134 with SMTP id f128mr5646wma.29.1488484424002; Thu, 02 Mar 2017 11:53:44 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:33 +0000 Message-Id: <20170302195337.31558-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22b Subject: [Qemu-devel] [PATCH v2 07/11] s390x/misc_helper.c: wrap IO instructions in BQL 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: mttcg@listserver.greensocs.com, Alexander Graf , nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Helpers that can trigger IO events (including interrupts) need to be protected by the BQL. I've updated all the helpers that call into an ioinst_handle_* functions. Reported-by: Thomas Huth Signed-off-by: Alex Benn=C3=A9e --- target/s390x/misc_helper.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 3cb942e8bb..93b0e61366 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -19,6 +19,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/memory.h" #include "qemu/host-utils.h" @@ -551,61 +552,81 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t or= der_code, uint32_t r1, void HELPER(xsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_xsch(cpu, r1); + qemu_mutex_unlock_iothread(); } =20 void HELPER(csch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_csch(cpu, r1); + qemu_mutex_unlock_iothread(); } =20 void HELPER(hsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_hsch(cpu, r1); + qemu_mutex_unlock_iothread(); } =20 void HELPER(msch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_msch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } =20 void HELPER(rchp)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_rchp(cpu, r1); + qemu_mutex_unlock_iothread(); } =20 void HELPER(rsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_rsch(cpu, r1); + qemu_mutex_unlock_iothread(); } =20 void HELPER(ssch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_ssch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } =20 void HELPER(stsch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_stsch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } =20 void HELPER(tsch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_tsch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } =20 void HELPER(chsc)(CPUS390XState *env, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_chsc(cpu, inst >> 16); + qemu_mutex_unlock_iothread(); } #endif =20 --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148848458782728.14169487425511; Thu, 2 Mar 2017 11:56:27 -0800 (PST) Received: from localhost ([::1]:54275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWpu-0001Gm-CC for importer@patchew.org; Thu, 02 Mar 2017 14:56:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnL-00083H-2J for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnK-0002Vz-7p for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:47 -0500 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]:34528) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnK-0002VZ-1w for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:46 -0500 Received: by mail-wr0-x231.google.com with SMTP id l37so60263338wrc.1 for ; Thu, 02 Mar 2017 11:53:45 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z88sm12167405wrb.26.2017.03.02.11.53.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:40 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A64A53E08FC; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=9rzbWDgHCcpb6723uLOqFuMOmTeT/3yN4F5tIjX81xA=; b=Bn7yZGsh171GFjD5EJ+3GUfhFOXS6DzuGfousaoJkRoP2S6ySCIZMYMTSSvSyKo/RO pCWaqmhqnn/kaWOtAkGRVIQGTyR7i7d9C6XHmGStWimHAouUbQX1mAhs/M5lSRYtyf/j 0XAN8qUNtiZY3DHwwa29nu46ZBb6VlEOQ+yNs= 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:mime-version:content-transfer-encoding; bh=9rzbWDgHCcpb6723uLOqFuMOmTeT/3yN4F5tIjX81xA=; b=YGdKAQDv3e6BzejO1FRXOnunwW726uDQfLbvSk3CBjgkEpgr/kU5jtvlQEvDm8ZTCO 77ckL58SApbFt8DOnO6kv3xbfdiFEaiZEeF6HDmrGKNKMSyTvctP9mUfI/0U6hUk1LGt P8ByBbHiscuyA6BPCLJB3dbDHBHk/qeK6zXRRGGOMa9VSq6CaS3cf+898WuRgF/VdAGC oAFUPUAGPOXWiIzkUHvAO0Fti24YuwcvHj2WXV/D7wna4i+VSX8KLwrpOPZ1FgN5SXqA CRHLLZxrf2rNQ70IWwwnCHsFazQht1orKxuDUPGvDUwtr/7CLnevq9Wrzh4+dKScjl8I 638Q== X-Gm-Message-State: AMke39k6jefmvhbq9dkGW+lw1HezmQEv3taIsy4ycU8vbnVuXXgCxtVCR1FVGEf39iuGsgQ8 X-Received: by 10.223.145.45 with SMTP id j42mr15307580wrj.141.1488484424860; Thu, 02 Mar 2017 11:53:44 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:34 +0000 Message-Id: <20170302195337.31558-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::231 Subject: [Qemu-devel] [PATCH v2 08/11] target/xtensa: hold BQL for interrupt processing 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, Max Filippov , cota@braap.org, bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Make sure we have the BQL held when processing interrupts. Reported-by: Thomas Huth Signed-off-by: Alex Benn=C3=A9e Acked-by: Max Filippov --- target/xtensa/helper.c | 1 + target/xtensa/op_helper.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index c67d715c4b..bcd0b7738d 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -217,6 +217,7 @@ static void handle_interrupt(CPUXtensaState *env) } } =20 +/* Called from cpu_handle_interrupt with BQL held */ void xtensa_cpu_do_interrupt(CPUState *cs) { XtensaCPU *cpu =3D XTENSA_CPU(cs); diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c index af2723445d..519fbeddd6 100644 --- a/target/xtensa/op_helper.c +++ b/target/xtensa/op_helper.c @@ -26,6 +26,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "qemu/host-utils.h" @@ -381,7 +382,11 @@ void HELPER(waiti)(CPUXtensaState *env, uint32_t pc, u= int32_t intlevel) env->pc =3D pc; env->sregs[PS] =3D (env->sregs[PS] & ~PS_INTLEVEL) | (intlevel << PS_INTLEVEL_SHIFT); + + qemu_mutex_lock_iothread(); check_interrupts(env); + qemu_mutex_unlock_iothread(); + if (env->pending_irq_level) { cpu_loop_exit(CPU(xtensa_env_get_cpu(env))); return; @@ -426,7 +431,9 @@ void HELPER(update_ccompare)(CPUXtensaState *env, uint3= 2_t i) =20 void HELPER(check_interrupts)(CPUXtensaState *env) { + qemu_mutex_lock_iothread(); check_interrupts(env); + qemu_mutex_unlock_iothread(); } =20 void HELPER(itlb_hit_test)(CPUXtensaState *env, uint32_t vaddr) --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488485077775924.6466625667751; Thu, 2 Mar 2017 12:04:37 -0800 (PST) Received: from localhost ([::1]:54319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWxn-0007ua-F7 for importer@patchew.org; Thu, 02 Mar 2017 15:04:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnO-00088f-My for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnM-0002X8-1o for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:50 -0500 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:36851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnL-0002Wm-Rt for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:47 -0500 Received: by mail-wr0-x22a.google.com with SMTP id u108so60200391wrb.3 for ; Thu, 02 Mar 2017 11:53:47 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id s26sm12139298wra.66.2017.03.02.11.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:43 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B71913E09CE; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=8FGZdgizmXDFKV3b+dt0xaa6x9HCoqZQdwSekLyfFVE=; b=gUrYvxkf06rwoRqWx9EChhj7DrTVIkUNLAxOYuKCkPW/ueuON0TQj0i8vgeXL6+zk3 lf8RGdWGZmQ6iiG+HqYZU5gDTuCOp5CYDHuYWJwCL5ZVh9cBTfR/R19eWbqnX1HaTi/O 0keZhOrcwRAwoz5Zs85ALz7WIuZLiwKlDV/UM= 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:mime-version:content-transfer-encoding; bh=8FGZdgizmXDFKV3b+dt0xaa6x9HCoqZQdwSekLyfFVE=; b=p6f1BEJih+vqNCU7ykVZMJqckhVtwdY8l9BxWdvN7G3cC3JUYjL7QJ5wMzcSCcCrce JLI8M4ybf1/sPRPp3j0DdQHX8UgqX4XKmH+HlRf5X9aBFRlIXJI1hjf0JCXYT6oiRCob AAe+dgKUOBbMwgJBD6Yqy60TpWjttjYMHgFNjEzejshtuFehfeGUXnic9xBzZXFsnB95 0x6IJ2/IHW5TRsqThfGS5h6oiPNaHtMSd8oi6i4E1xD3xLSjoQxlMyOTl190O9XLq7xK 7WIWSN3jufDNOWywNix+MNySTnAPaaODv3tS6iGzrsVwXSg0IejQ3YjPsj+oCiY4J4df S50g== X-Gm-Message-State: AMke39mjLexcbvCdCHsYS9FfoyigV3ZT1Ou8gY0DGwIIp1jibXrfFxznutMindxpx+a/aHeg X-Received: by 10.223.155.211 with SMTP id e19mr13319522wrc.74.1488484426679; Thu, 02 Mar 2017 11:53:46 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:35 +0000 Message-Id: <20170302195337.31558-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22a Subject: [Qemu-devel] [PATCH v2 09/11] target/mips/op_helper: hold BQL before calling cpu_mips_get_count 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, Yongbok Kim , bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 We should hold the BQL before we transition to HW emulation. This is because all HW emulation needs to be serialised under MTTCG conditions. This is picked up by asserts that fire when cpu_mips_get_count triggers and IRQ. Reported-by: Yongbok Kim Signed-off-by: Alex Benn=C3=A9e --- target/mips/op_helper.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c index b683fcb025..38bca03f52 100644 --- a/target/mips/op_helper.c +++ b/target/mips/op_helper.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "qemu/host-utils.h" #include "exec/helper-proto.h" @@ -827,7 +828,13 @@ target_ulong helper_mftc0_tcschefback(CPUMIPSState *en= v) =20 target_ulong helper_mfc0_count(CPUMIPSState *env) { - return (int32_t)cpu_mips_get_count(env); + int32_t count; + + qemu_mutex_lock_iothread(); + count =3D (int32_t)cpu_mips_get_count(env); + qemu_mutex_unlock_iothread(); + + return count; } =20 target_ulong helper_mftc0_entryhi(CPUMIPSState *env) @@ -2296,12 +2303,16 @@ target_ulong helper_rdhwr_synci_step(CPUMIPSState *= env) =20 target_ulong helper_rdhwr_cc(CPUMIPSState *env) { + int32_t count; check_hwrena(env, 2, GETPC()); #ifdef CONFIG_USER_ONLY - return env->CP0_Count; + count =3D env->CP0_Count; #else - return (int32_t)cpu_mips_get_count(env); + qemu_mutex_lock_iothread(); + count =3D (int32_t)cpu_mips_get_count(env); + qemu_mutex_unlock_iothread(); #endif + return count; } =20 target_ulong helper_rdhwr_ccres(CPUMIPSState *env) --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484959712595.5691709808596; Thu, 2 Mar 2017 12:02:39 -0800 (PST) Received: from localhost ([::1]:54313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWvt-0006Ly-Ez for importer@patchew.org; Thu, 02 Mar 2017 15:02:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnM-000860-18 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnL-0002WW-5R for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:48 -0500 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:34533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnL-0002W6-05 for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:47 -0500 Received: by mail-wr0-x22b.google.com with SMTP id l37so60263651wrc.1 for ; Thu, 02 Mar 2017 11:53:46 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c58sm12199234wrc.9.2017.03.02.11.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:43 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C7A7A3E0A6B; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=Cw6Ml//08hNiFaKMgILP5ANJojfV0XJPHxDXZl/xqZE=; b=N61LyqXA1WFRw+/RKoWZI3IUeFb5YKfhyh/lIv1QziNxU9GrJmmZMkUn9R6H1TkxiM DnxXnV3wruITr0wXxNXpPnLiEXFSInsZuW9v9wIii1yyMQxYbFyRNPBLqPOHl40HCR3F dHLpa01yfdToN0IzCcl8R+QxOd8n0z550N4N4= 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:mime-version:content-transfer-encoding; bh=Cw6Ml//08hNiFaKMgILP5ANJojfV0XJPHxDXZl/xqZE=; b=TpsyUW3CXC+yAelHBvCHznWRpPpi6J5oxaocvRBH/mDlhLFLB0fc3StGtpnrHc8l1R U/s5jpA/TpkJWHpv+lk/JF0KrqaBcJigKroaMxqa2N/dj6oN1WqQcCnVh+ERElxBhCmA /uAKWEGzxm/HbA7DYpryvdR9ApMgyONTOYwFjeDhsRM24cu40gwIOdU3UhV2NgD+1kXv EoQsTOnkdHDW4g3aGx/udrUU3gJhApob3tAP5svCh+WjlS2gMiES71Cog/rzC+ESmmTl rXN3dHqDsA6Yqho9b7u9+WPSVqZbSgd8oSLzeobyujFipyB0QOTvRh3f0Upd525/LTFQ 9dFw== X-Gm-Message-State: AMke39nSsmJXSwC9WPNd6zuxVeSzWhTN718e+/7B9tnAvuGwq90STmy3hK16iLYHSBwODu5y X-Received: by 10.223.134.149 with SMTP id 21mr9415125wrx.1.1488484425793; Thu, 02 Mar 2017 11:53:45 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:36 +0000 Message-Id: <20170302195337.31558-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [PATCH v2 10/11] target/arm/helper: make it clear the EC field is also in hex 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, "open list:ARM" , bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 ..just like the rest of the displayed ESR register. Otherwise people might scratch their heads if a not obviously hex number is displayed for the EC field. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: KONRAD Frederic Reviewed-by: Peter Maydell --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3f4211b572..76b608f0ba 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6857,7 +6857,7 @@ void arm_cpu_do_interrupt(CPUState *cs) new_el); if (qemu_loglevel_mask(CPU_LOG_INT) && !excp_is_internal(cs->exception_index)) { - qemu_log_mask(CPU_LOG_INT, "...with ESR %x/0x%" PRIx32 "\n", + qemu_log_mask(CPU_LOG_INT, "...with ESR 0x%x/0x%" PRIx32 "\n", env->exception.syndrome >> ARM_EL_EC_SHIFT, env->exception.syndrome); } --=20 2.11.0 From nobody Thu May 2 16:22:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488484803096337.0416145394863; Thu, 2 Mar 2017 12:00:03 -0800 (PST) Received: from localhost ([::1]:54292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWtN-0004Jq-Pf for importer@patchew.org; Thu, 02 Mar 2017 15:00:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjWnO-00088e-Mr for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjWnM-0002Xb-Tr for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:50 -0500 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:36200) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjWnM-0002XF-Nr for qemu-devel@nongnu.org; Thu, 02 Mar 2017 14:53:48 -0500 Received: by mail-wm0-x22d.google.com with SMTP id n11so96810wma.1 for ; Thu, 02 Mar 2017 11:53:48 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t194sm24255300wmd.13.2017.03.02.11.53.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 11:53:43 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id D84C83E0BD2; Thu, 2 Mar 2017 19:53:37 +0000 (GMT) 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 :mime-version:content-transfer-encoding; bh=KWSZlo/VylAEpDhSQ11RJbzh5kr+PSDdFD5j+DQAcZc=; b=NvKxlrNGs+aZ/cHMdrHjQdmSXDes64Gp/FBGGvAv6Uq1XuMCZYZ45A8Tu44ChxbcQw C6nqvLB91GjxD2+9kiaJxc86JnctMth7n/fcVCL8JFm7yHyJdsBVP9gtgDAH1pbqVEOD zsd4YR1FLLT1Umhhjxbz2VJiIwEyos/Cw3kxE= 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:mime-version:content-transfer-encoding; bh=KWSZlo/VylAEpDhSQ11RJbzh5kr+PSDdFD5j+DQAcZc=; b=onyTmq1RihsJYejgV1YETAoI/cBHdg/ysDxXkt5M/QkoIR41tnce7pg6kzmb+M868H 2a8RWAlUsAOrS//2dWHkM42i1KJ3pCk60WFZayHOCZVyFsyU8xe+WB0Wnh+RF64bh3s7 zljolBWRwvsJxvG8apkpzpFR3IzVDL9AgWUYN+zHcGGimUAHtHdiqLzcsp9alHyXla0r tMXzVo1KbAua4nQLg/cy4UDime8kdVe7UcFC8WMUr2mMX0FJH6om4nk30dJ2TED55IcA sxf8sWIso1nEY6TOPW7mqYT5q+oTvP4aVJJ+sC/QzdPylySXXFZZeMwLQdZ55p9pR8gb c8NA== X-Gm-Message-State: AMke39lQmFVuVTaPGiuwdH8yHfwMPZwgd+2fvnBMOBHxzcrfXA3oL30X3OR1LuACT4wOy85c X-Received: by 10.28.179.7 with SMTP id c7mr8382wmf.128.1488484427603; Thu, 02 Mar 2017 11:53:47 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Thu, 2 Mar 2017 19:53:37 +0000 Message-Id: <20170302195337.31558-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org> References: <20170302195337.31558-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22d Subject: [Qemu-devel] [PATCH v2 11/11] hw/intc/arm_gic: modernise the DPRINTF 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, "open list:ARM cores" , bobby.prani@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 While I was debugging the icount issues I realised a bunch of the messages look quite similar. I've fixed this by including __func__ in the debug print. At the same time I move the a modern if (GATE) style printf which ensures the compiler can check for format string errors even if the code gets optimised away in the non-DEBUG_GIC case. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell --- hw/intc/arm_gic.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index 8e5a9d8a3e..b305d9032a 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -26,15 +26,20 @@ #include "qemu/log.h" #include "trace.h" =20 -//#define DEBUG_GIC +/* #define DEBUG_GIC */ =20 #ifdef DEBUG_GIC -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, "arm_gic: " fmt , ## __VA_ARGS__); } while (0) +#define DEBUG_GIC_GATE 1 #else -#define DPRINTF(fmt, ...) do {} while(0) +#define DEBUG_GIC_GATE 0 #endif =20 +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_GIC_GATE) { \ + fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \ + } \ + } while (0) + static const uint8_t gic_id_11mpcore[] =3D { 0x00, 0x00, 0x00, 0x00, 0x90, 0x13, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; --=20 2.11.0