From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1yQl-0000Ma-BO for qemu-devel@nongnu.org; Wed, 02 Nov 2016 12:30:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1yQg-0007z3-EG for qemu-devel@nongnu.org; Wed, 02 Nov 2016 12:30:27 -0400 Received: from mail-yb0-x242.google.com ([2607:f8b0:4002:c09::242]:34984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1yQg-0007yn-AN for qemu-devel@nongnu.org; Wed, 02 Nov 2016 12:30:22 -0400 Received: by mail-yb0-x242.google.com with SMTP id e129so376016yba.2 for ; Wed, 02 Nov 2016 09:30:22 -0700 (PDT) References: <20161102142559.23395-1-bobby.prani@gmail.com> <8737j9vokj.fsf@linaro.org> From: Pranith Kumar In-reply-to: <8737j9vokj.fsf@linaro.org> Date: Wed, 02 Nov 2016 12:30:20 -0400 Message-ID: <87r36tzvxf.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] mttcg: Handle EXCP_ATOMIC exception List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex =?utf-8?Q?Benn=C3=A9e?= Cc: qemu-devel@nongnu.org, pbonzini@redhat.com Alex Bennée writes: > Pranith Kumar writes: > >> 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; > > Hmm don't we need to unlock the iothread here as well? I suspect you > never see a deadlock because the rr thread can't by definition race with > itself but the locking practice should be the same for both cases. > Yes, not having any other thread to race with is the reason I did not unlock the iothread. But, I agree that the semantics need to be the same. I will send an updated patch. Thanks, -- Pranith