From patchwork Wed Feb 1 15:05:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 93066 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2469711qgi; Wed, 1 Feb 2017 07:30:37 -0800 (PST) X-Received: by 10.55.11.130 with SMTP id 124mr3214864qkl.27.1485963037095; Wed, 01 Feb 2017 07:30:37 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b197si12405266qkc.251.2017.02.01.07.30.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 01 Feb 2017 07:30:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYwrk-0005ES-J3 for patch@linaro.org; Wed, 01 Feb 2017 10:30:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYwU6-0007C3-KF for qemu-devel@nongnu.org; Wed, 01 Feb 2017 10:06:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYwU2-0008HA-C9 for qemu-devel@nongnu.org; Wed, 01 Feb 2017 10:06:10 -0500 Received: from mail-wj0-x234.google.com ([2a00:1450:400c:c01::234]:34315) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYwU2-0008Gj-6x for qemu-devel@nongnu.org; Wed, 01 Feb 2017 10:06:06 -0500 Received: by mail-wj0-x234.google.com with SMTP id uo9so21300691wjc.1 for ; Wed, 01 Feb 2017 07:06:06 -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 :mime-version:content-transfer-encoding; bh=vp8ExxcF58dNAqavMaLO29LPlP1rgbh1h1jw9l7kNOk=; b=Us97jAkJMEPncxjdLCdTwukVlvpPFhw7NkPNcqiAMviIQ4TQXtUmqSWRChJ0m2GYA+ 5ahJTm+evEiGMhFA8/HFFTHyfFvIR0rAR3zRxG1eYGe5Hc/Ohjk8JNt4pVfCOVT2y27p d3klcgkIWA1WSYHEjg5LzUcEBRnb8p7NcZGZ0= 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=vp8ExxcF58dNAqavMaLO29LPlP1rgbh1h1jw9l7kNOk=; b=sLNGdAUkiwQgM73zLgvh8qANj08DWY0xwf03wqt9qMtiZndlEEnRi9PYMd2i1+qiue XCsTPmKms4TQIfwi03Xrx4FHHSDBNvsFEPTaKjpeHvsu/E6e8jKAVYWf/qQY6qUG9wJM YH22s1ARqjcIkiA0Qc0FNKOGJuw7Ylmqf7dzW6wT4lUBRHEhGU5tqqaa3pPKxd35TUqn VNHxRnXYEMLSa5Bv/uhw4lEWQEvnFmqaOfLyGBJFoyOtfIEAKhqh1f5pEbQVBSvLkhVG eus+bK5lCkA9v/JOIO8GuaHdRJZqk9CX7tK47q4OyMA5eYnriHuj+pIvirEKY6+64Kq4 3HKw== X-Gm-Message-State: AIkVDXIgo61wyul5ZCzGdKXE3vntW+xf6OS2XUwRNpqDV8sMRJBv4lwSeWP1EMs99r0+7wMd X-Received: by 10.223.132.39 with SMTP id 36mr3362262wrf.130.1485961565136; Wed, 01 Feb 2017 07:06:05 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 8sm39230045wmg.1.2017.02.01.07.05.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 07:05:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4C7FC3E0CF4; Wed, 1 Feb 2017 15:05:54 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com Date: Wed, 1 Feb 2017 15:05:40 +0000 Message-Id: <20170201150553.9381-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170201150553.9381-1-alex.bennee@linaro.org> References: <20170201150553.9381-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c01::234 Subject: [Qemu-devel] [PATCH v9 12/25] tcg: handle EXCP_ATOMIC exception for system emulation 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, Peter Crosthwaite , jan.kiszka@siemens.com, mark.burton@greensocs.com, serge.fdrv@gmail.com, pbonzini@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , bamvor.zhangjian@linaro.org, rth@twiddle.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Pranith Kumar 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 [AJB: tweak title] Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- cpus.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.11.0 diff --git a/cpus.c b/cpus.c index ecd1ec08d3..e3d9f3fe21 100644 --- a/cpus.c +++ b/cpus.c @@ -1346,6 +1346,11 @@ 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) { + qemu_mutex_unlock_iothread(); + cpu_exec_step_atomic(cpu); + qemu_mutex_lock_iothread(); + break; } } else if (cpu->stop) { if (cpu->unplug) { @@ -1456,6 +1461,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;