From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1wUP-0005zy-5y for qemu-devel@nongnu.org; Wed, 02 Nov 2016 10:26:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1wUM-0002Tn-0n for qemu-devel@nongnu.org; Wed, 02 Nov 2016 10:26:05 -0400 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:32815) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1wUL-0002Tb-ST for qemu-devel@nongnu.org; Wed, 02 Nov 2016 10:26:01 -0400 Received: by mail-yw0-x244.google.com with SMTP id s68so581286ywg.0 for ; Wed, 02 Nov 2016 07:26:01 -0700 (PDT) From: Pranith Kumar Date: Wed, 2 Nov 2016 10:25:59 -0400 Message-Id: <20161102142559.23395-1-bobby.prani@gmail.com> Subject: [Qemu-devel] [PATCH] mttcg: Handle EXCP_ATOMIC exception List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, alex.bennee@linaro.org Cc: pbonzini@redhat.com The patch enables handling atomic code in the guest. This should be preferably done in cpu_handle_exception(), but the current assumptions regarding when we can execute atomic sections cause a deadlock. Signed-off-by: Pranith Kumar --- cpus.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpus.c b/cpus.c index 8f98060..c4ba7d8 100644 --- a/cpus.c +++ b/cpus.c @@ -1315,6 +1315,9 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); break; + } else if (r == EXCP_ATOMIC) { + cpu_exec_step_atomic(cpu); + break; } } else if (cpu->stop) { if (cpu->unplug) { @@ -1385,6 +1388,10 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) */ g_assert(cpu->halted); break; + case EXCP_ATOMIC: + qemu_mutex_unlock_iothread(); + cpu_exec_step_atomic(cpu); + qemu_mutex_lock_iothread(); default: /* Ignore everything else? */ break; -- 2.10.2