From patchwork Wed May 12 21:24:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 52423 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 ozlabs.org (Postfix) with ESMTPS id 91C3BB7E10 for ; Thu, 13 May 2010 13:50:35 +1000 (EST) Received: from localhost ([127.0.0.1]:34669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCPQv-0002U4-JO for incoming@patchwork.ozlabs.org; Wed, 12 May 2010 23:50:01 -0400 Received: from [140.186.70.92] (port=41146 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCP3T-0008W1-Ux for qemu-devel@nongnu.org; Wed, 12 May 2010 23:25:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCKVJ-0003Fa-T5 for qemu-devel@nongnu.org; Wed, 12 May 2010 18:34:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50362) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCJSO-0000tD-HA for qemu-devel@nongnu.org; Wed, 12 May 2010 17:27:09 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR25c014560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 May 2010 17:27:02 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR1b3020954; Wed, 12 May 2010 17:27:01 -0400 Received: from amt.cnet (vpn2-10-158.ams2.redhat.com [10.36.10.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLQxwO021851; Wed, 12 May 2010 17:27:00 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 8656F656077; Wed, 12 May 2010 18:25:44 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o4CLPefM028644; Wed, 12 May 2010 18:25:40 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Wed, 12 May 2010 18:24:56 -0300 Message-Id: <273faf1b6dbdedd0fe9fc519ec73380eced667c2.1273699506.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity Subject: [Qemu-devel] [PATCH 02/12] kvm: set cpu_single_env around KVM_RUN ioctl 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 Zero cpu_single_env before leaving global lock protection, and restore on return. Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- kvm-all.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 6962b2b..fbd084c 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -838,9 +838,11 @@ int kvm_cpu_exec(CPUState *env) } kvm_arch_pre_run(env, run); + cpu_single_env = NULL; qemu_mutex_unlock_iothread(); ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); qemu_mutex_lock_iothread(); + cpu_single_env = env; kvm_arch_post_run(env, run); if (ret == -EINTR || ret == -EAGAIN) {