From patchwork Wed Nov 2 16:40:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 690476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t8DQM35Jtz9t1F for ; Thu, 3 Nov 2016 03:41:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=O+5+shB+; dkim-atps=neutral Received: from localhost ([::1]:56357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1ybf-0006Mo-NZ for incoming@patchwork.ozlabs.org; Wed, 02 Nov 2016 12:41:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1yaG-0004vU-Qb for qemu-devel@nongnu.org; Wed, 02 Nov 2016 12:40:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1yaB-00035D-Tk for qemu-devel@nongnu.org; Wed, 02 Nov 2016 12:40:16 -0400 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:36636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1yaB-00034t-MV for qemu-devel@nongnu.org; Wed, 02 Nov 2016 12:40:11 -0400 Received: by mail-yw0-x244.google.com with SMTP id r204so701226ywb.3 for ; Wed, 02 Nov 2016 09:40:11 -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:in-reply-to:references; bh=6nvyBScHki7gCfxrM106CV+tn/FOuHtsC412BlDoWPo=; b=O+5+shB+MDNdCnw1qyJUFQ+aXrFQrBIRXPJgrB3dhE4/v2I0PAkVUvVKY017CmOgyr xRh4ZFiADLXNgAuIWeKf/YeulF5XWFyIoVmaLqgDP1Xw7XZuxHr8YTQZyiKodGyxI+PW OB/xIlwadjSNSUUhv1LsUQv8wo9/B6yBo5rfVc+/1xqLjxZ5oj186TnORvIMtsbPgLmc Q9/qWnhjyeAC5Mh+wU+KFTfEfIiEZdR7nPqVCyPT62oAoFRHGtOiVz3NXyL4w/KserOt x9yHqvaTvLsGs//1MIYKSaxI+8m6whZBY6nGnvKlEjAakbsC54oGzPrtXGgaO+o9vxMK PLYg== 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:in-reply-to :references; bh=6nvyBScHki7gCfxrM106CV+tn/FOuHtsC412BlDoWPo=; b=dA4UtQcH8wkgc6uQK3RRocHARXLB4Xs25jjYg2L/OTZ/c9r/jwpLcWK4+CPFKyv9eJ egr53+eKDGvuZQGsrEzyfAJSjzILBZfIUNcxBPhXd054GhG71687iwNKDXnutdeE0XSL pNtmGLC6Nlb9gJnNffsgPwzRLJuCgunG0H2WogNNNZvAqnlXYcM48tGyPjQkEpfaUvF4 S+X5AGCsojY6CVAWyfmgrE/1/5jaAYLcvMTpG+Ty5AWzX+fyv3Gdhs0EFgoAcmR4jyLs Ti8Tuck78+zmuy28pdN+s/XqpJaklV+RwGDsIQeWLcWKsvINuo9p6uH4wuLT0jYW7qn3 OkOA== X-Gm-Message-State: ABUngvfWoYmSx4jnfDpyvX3hirKw6vxPUJ212Aw8IlVx/m+qNx96o8nZCDRW6+dnPsu0FA== X-Received: by 10.13.195.1 with SMTP id f1mr3713300ywd.354.1478104810299; Wed, 02 Nov 2016 09:40:10 -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 u12sm832048ywf.37.2016.11.02.09.40.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Nov 2016 09:40:09 -0700 (PDT) From: Pranith Kumar To: qemu-devel@nongnu.org, alex.bennee@linaro.org Date: Wed, 2 Nov 2016 12:40:08 -0400 Message-Id: <20161102164008.28401-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161102142559.23395-1-bobby.prani@gmail.com> References: <20161102142559.23395-1-bobby.prani@gmail.com> 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 v2] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpus.c b/cpus.c index 8f98060..299ce7e 100644 --- a/cpus.c +++ b/cpus.c @@ -1315,6 +1315,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) { @@ -1385,6 +1390,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;