From nobody Sat Nov 1 07:50:16 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509634335049560.8199313234745; Thu, 2 Nov 2017 07:52:15 -0700 (PDT) Received: from localhost ([::1]:60628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAGqS-0000il-Sz for importer@patchew.org; Thu, 02 Nov 2017 10:51:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAGpU-0000Gi-T1 for qemu-devel@nongnu.org; Thu, 02 Nov 2017 10:50:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAGpU-0005Bg-0N for qemu-devel@nongnu.org; Thu, 02 Nov 2017 10:50:48 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:38120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eAGpT-0005BH-P2 for qemu-devel@nongnu.org; Thu, 02 Nov 2017 10:50:47 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eAGpQ-0002tS-IZ; Thu, 02 Nov 2017 14:50:44 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 2 Nov 2017 14:51:13 +0000 Message-Id: <1509634273-29111-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] cpu-exec: Exit exclusive region on longjmp from step_atomic 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: "Emilio G . Cota" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit ac03ee5331612e44be narrowed the scope of the exclusive region so it only covers when we're executing the TB, not when we're generating it. However it missed that there is more than one execution path out of cpu_tb_exec -- if the atomic insn causes an exception then the code will longjmp out, skipping the code to end the exclusive region. This causes QEMU to hang the next time the CPU calls start_exclusive(), waiting for itself to exit the region. Move the "end the region" code out to the end of the function so that it is run for both normal exit and also for exit-via-longjmp. (For some reason this only reproduces for me with a clang optimized build, not a gcc debug build.) Fixes: ac03ee5331612e44beb393df2b578c951d27dc0d Signed-off-by: Peter Maydell --- accel/tcg/cpu-exec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 4318441..ac316bb 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -256,9 +256,6 @@ void cpu_exec_step_atomic(CPUState *cpu) trace_exec_tb(tb, pc); cpu_tb_exec(cpu, tb); cc->cpu_exec_exit(cpu); - parallel_cpus =3D true; - - end_exclusive(); } else { /* We may have exited due to another problem here, so we need * to reset any tb_locks we may have taken but didn't release. @@ -270,6 +267,9 @@ void cpu_exec_step_atomic(CPUState *cpu) #endif tb_lock_reset(); } + + parallel_cpus =3D true; + end_exclusive(); } =20 struct tb_desc { --=20 2.7.4