From patchwork Fri Jan 27 10:34:52 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: 92595 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp141612obz; Fri, 27 Jan 2017 02:47:36 -0800 (PST) X-Received: by 10.55.138.196 with SMTP id m187mr7410426qkd.214.1485514056176; Fri, 27 Jan 2017 02:47:36 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c41si3240847qta.309.2017.01.27.02.47.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 27 Jan 2017 02:47:36 -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]:44272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cX445-0001Uu-Hu for patch@linaro.org; Fri, 27 Jan 2017 05:47:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cX3sM-0007xv-Fp for qemu-devel@nongnu.org; Fri, 27 Jan 2017 05:35:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cX3sI-0002DU-PQ for qemu-devel@nongnu.org; Fri, 27 Jan 2017 05:35:26 -0500 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:34764) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cX3sI-0002D6-JX for qemu-devel@nongnu.org; Fri, 27 Jan 2017 05:35:22 -0500 Received: by mail-wm0-x231.google.com with SMTP id f73so12548277wmf.1 for ; Fri, 27 Jan 2017 02:35:22 -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=I9xeptTo0yQMJ8RRqhOGfo1wqE8lZv+Og9mcEANZ8BDixpSHjlv/7/N4TnI19PzTPb Kerksy4Hkbb6amkIlD+V2WJwedV/cMlRkgylMQRq9vyZMdCW86eZBq4dAVSFOhkYIYqE jLxIVcM+X3uA+KibqF/BsGSdZNimbzbtVzl20= 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=fRlWbd3aFg4Eirx590r1r0GZOZbydP8KACykHhECyP2CRF6FOQfhFQ8NuVcv5S+oyb PKzafUxNqavdZXvDvQelVAGN1ams05snl3Ns/Z4+cm2Z5E2+Kk28KM3kMKbAUjSeY0hM 3dPhbyIaJ4OH8CAy+r+q4sNWLyh3esnqmL9fAUgnW8cPMaBZbV9MaBENMiJAeWMZXLfX ViIeMIcsFF5X/qvvx7/EuX5iVdQ1ELTg0+0/cY+uMojw2EhMWSs5nMhteRa4TKeQ1Njd G1djG8dryLa5/pc5E6wX56o1Qaf+DZFTa9nyx6Vwl5raqv5gnaVMLFSAwB7x6+jE63Hk ONYA== X-Gm-Message-State: AIkVDXKUGvLiBzutI5cOz5mR5xUnRF4/sU20YV66bvKBAJlMI2h2+M73rkNEzyjlNkX4BI0I X-Received: by 10.223.138.9 with SMTP id w9mr6909383wrw.50.1485513321582; Fri, 27 Jan 2017 02:35:21 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g71sm3150622wmc.9.2017.01.27.02.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jan 2017 02:35:16 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 781593E3763; Fri, 27 Jan 2017 10:35:06 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: Date: Fri, 27 Jan 2017 10:34:52 +0000 Message-Id: <20170127103505.18606-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170127103505.18606-1-alex.bennee@linaro.org> References: <20170127103505.18606-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:c09::231 Subject: [Qemu-devel] [PATCH v8 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 Crosthwaite , "open list:Overall" , Paolo Bonzini , Pranith Kumar , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson 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;