From patchwork Tue Aug 25 22:13:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 32102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 9499BB6F1F for ; Wed, 26 Aug 2009 12:16:36 +1000 (EST) Received: from localhost ([127.0.0.1]:59413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mg83s-0006hI-QO for incoming@patchwork.ozlabs.org; Tue, 25 Aug 2009 22:16:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mg81C-0004mq-UW for qemu-devel@nongnu.org; Tue, 25 Aug 2009 22:13:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mg817-0004gn-Oo for qemu-devel@nongnu.org; Tue, 25 Aug 2009 22:13:45 -0400 Received: from [199.232.76.173] (port=45242 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mg816-0004gC-VF for qemu-devel@nongnu.org; Tue, 25 Aug 2009 22:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63005) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mg816-0008OX-5D for qemu-devel@nongnu.org; Tue, 25 Aug 2009 22:13:40 -0400 Received: from int-mx06.intmail.prod.int.phx2.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.19]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7Q2DcNK017102; Tue, 25 Aug 2009 22:13:38 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by int-mx06.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7Q2DboI031989; Tue, 25 Aug 2009 22:13:37 -0400 From: Glauber Costa To: qemu-devel@nongnu.org Date: Tue, 25 Aug 2009 18:13:35 -0400 Message-Id: <1251238416-5088-2-git-send-email-glommer@redhat.com> In-Reply-To: <1251238416-5088-1-git-send-email-glommer@redhat.com> References: <1251238416-5088-1-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.19 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 1/2] unlock iothread before running vpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Glauber Costa --- kvm-all.c | 4 ++++ qemu-common.h | 4 ++++ vl.c | 9 ++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index f669c3a..d9d7e06 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -591,7 +591,11 @@ int kvm_cpu_exec(CPUState *env) } kvm_arch_pre_run(env, run); + + qemu_mutex_unlock_iothread(); ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); + qemu_mutex_lock_iothread(); + kvm_arch_post_run(env, run); if (ret == -EINTR || ret == -EAGAIN) { diff --git a/qemu-common.h b/qemu-common.h index 74ac88f..69486ed 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -207,6 +207,10 @@ void qemu_notify_event(void); void qemu_cpu_kick(void *env); int qemu_cpu_self(void *env); + +void qemu_mutex_lock_iothread(void); +void qemu_mutex_unlock_iothread(void); + #ifdef CONFIG_USER_ONLY #define qemu_init_vcpu(env) do { } while (0) #else diff --git a/vl.c b/vl.c index c164f45..aa5047e 100644 --- a/vl.c +++ b/vl.c @@ -3595,14 +3595,13 @@ void qemu_notify_event(void) } } -#define qemu_mutex_lock_iothread() do { } while (0) -#define qemu_mutex_unlock_iothread() do { } while (0) - void vm_stop(int reason) { do_vm_stop(reason); } +void qemu_mutex_lock_iothread(void) {} +void qemu_mutex_unlock_iothread(void) {} #else /* CONFIG_IOTHREAD */ #include "qemu-thread.h" @@ -3788,7 +3787,7 @@ static void qemu_signal_lock(unsigned int msecs) qemu_mutex_unlock(&qemu_fair_mutex); } -static void qemu_mutex_lock_iothread(void) +void qemu_mutex_lock_iothread(void) { if (kvm_enabled()) { qemu_mutex_lock(&qemu_fair_mutex); @@ -3798,7 +3797,7 @@ static void qemu_mutex_lock_iothread(void) qemu_signal_lock(100); } -static void qemu_mutex_unlock_iothread(void) +void qemu_mutex_unlock_iothread(void) { qemu_mutex_unlock(&qemu_global_mutex); }