From patchwork Wed Nov 2 14:25:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9409275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2AA0760721 for ; Wed, 2 Nov 2016 14:27:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19D8B2A159 for ; Wed, 2 Nov 2016 14:27:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E3DD2A240; Wed, 2 Nov 2016 14:27:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 973962A159 for ; Wed, 2 Nov 2016 14:27:22 +0000 (UTC) Received: from localhost ([::1]:55595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1wVd-0006c5-Gj for patchwork-qemu-devel@patchwork.kernel.org; Wed, 02 Nov 2016 10:27:21 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Wg2wtmWRb6FKKGs8KbjmcWFXAYPONJTe+9Ox6PcqwC4=; b=NOOOX7noNAmqLtH9+Yx1Z/tIC03zjY6ARINeizHQIBz/E7SXytSeLTylN3BosA/PRY 6mDdZ8kDISBWfYmleNnJ0THJmZA5BXdBPVEijJs762gkEaepLbPXjXUEEsx9hq8K36Eh Tm3CQl6kuJAnRqfvgxSwLAsWmutYLuI47xTczS01WhwC+oYiXdhOfIyWL007xgEaGwJ3 XXNDO2GWibQxmNVAohdnjA23f6UiYexpuhTgahlo41FkzXttcLVg2SshJY3CNCtnAlsN 5V3RGMp7MShVI/Jb+GyOjWLqZknGlB1S45+ofkjBNZo5beJsJTsLfo5jZukmP1SMwdPJ Cvzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Wg2wtmWRb6FKKGs8KbjmcWFXAYPONJTe+9Ox6PcqwC4=; b=IubqJ+avsCFOh7REnT/+h4NjLbDBPwCCFV+iag3qB5jbroficKseJICk4uia0+qeGr iR8VgNqN9Slk5RTQxjjY/bFeHjC1DJOFpccC2cyIbMja9U/cQjNDw7ge0bKASAzc5wi0 bf33Pn9Qemz1mRYFrqCMwT9zECUE4kn21QVN2vbhYDqvPfXVOIuIu9qjnZBka7aDfKp2 +ubNNsGLXVrJvnFMA7bP5nGZXffpWJ2eB/gOpl13rSn32L20suOjD4F7EDrnoO7gqFEy +5XVZX1d9AE7e6XeREifK97GgCps/jP0Eyeie9iahpS9th6pZqLnmPmNWvcKU0Ge5w3/ tpOA== X-Gm-Message-State: ABUngvesL36BPIEVFsuaaekSobBM+19iUrzW+KiHGaZUXvnnoInA2d36oxfkpUrpmY3yqA== X-Received: by 10.129.41.3 with SMTP id p3mr2685314ywp.324.1478096760712; Wed, 02 Nov 2016 07:26:00 -0700 (PDT) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id y205sm674668ywy.4.2016.11.02.07.25.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Nov 2016 07:26:00 -0700 (PDT) From: Pranith Kumar To: qemu-devel@nongnu.org, alex.bennee@linaro.org Date: Wed, 2 Nov 2016 10:25:59 -0400 Message-Id: <20161102142559.23395-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.10.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::244 Subject: [Qemu-devel] [PATCH] mttcg: Handle EXCP_ATOMIC exception 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: pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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;