From patchwork Thu Mar 5 12:12:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10022 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n25CD4uf021665 for ; Thu, 5 Mar 2009 12:13:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754255AbZCEMND (ORCPT ); Thu, 5 Mar 2009 07:13:03 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754180AbZCEMND (ORCPT ); Thu, 5 Mar 2009 07:13:03 -0500 Received: from wa4ehsobe005.messaging.microsoft.com ([216.32.181.15]:13633 "EHLO WA4EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753505AbZCEMM5 (ORCPT ); Thu, 5 Mar 2009 07:12:57 -0500 Received: from mail167-wa4-R.bigfish.com (10.8.14.243) by WA4EHSOBE006.bigfish.com (10.8.40.26) with Microsoft SMTP Server id 8.1.340.0; Thu, 5 Mar 2009 12:12:52 +0000 Received: from mail167-wa4 (localhost.localdomain [127.0.0.1]) by mail167-wa4-R.bigfish.com (Postfix) with ESMTP id BC7E29D02C2; Thu, 5 Mar 2009 12:12:52 +0000 (UTC) X-BigFish: VPS11(z1857rzzzzzz32i64h) X-Spam-TCS-SCL: 3:0 Received: by mail167-wa4 (MessageSwitch) id 1236255171120521_14515; Thu, 5 Mar 2009 12:12:51 +0000 (UCT) Received: from ausb3extmailp01.amd.com (unknown [163.181.251.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail167-wa4.bigfish.com (Postfix) with ESMTP id 1CAB81A58055; Thu, 5 Mar 2009 12:12:49 +0000 (UTC) Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n25CCiiA006456; Thu, 5 Mar 2009 06:12:47 -0600 X-WSS-ID: 0KG18L4-02-DEF-01 Received: from sausexbh1.amd.com (sausexbh1.amd.com [163.181.22.101]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 23D1F16A03C3; Thu, 5 Mar 2009 06:12:40 -0600 (CST) Received: from sausexmb2.amd.com ([163.181.3.157]) by sausexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 06:12:45 -0600 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 06:12:45 -0600 Received: from seurexmb1.amd.com ([165.204.82.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 13:12:35 +0100 Received: from lemmy.amd.com ([165.204.85.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Mar 2009 13:12:33 +0100 Received: by lemmy.amd.com (Postfix, from userid 41430) id BE56253934; Thu, 5 Mar 2009 13:12:33 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 5/6] kvm/x86: call kvm_lapic_sync_from_vapic with preemption disabled Date: Thu, 5 Mar 2009 13:12:32 +0100 Message-ID: <1236255153-4432-6-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.5.6.4 In-Reply-To: <1236255153-4432-1-git-send-email-joerg.roedel@amd.com> References: <1236255153-4432-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 05 Mar 2009 12:12:33.0811 (UTC) FILETIME=[AA30CE30:01C99D8B] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The function uses kmap_atomic. Calling it with preemption enabled is racy. Signed-off-by: Joerg Roedel --- arch/x86/kvm/x86.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b556b6a..ff833f4 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3203,6 +3203,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) kvm_guest_exit(); + kvm_lapic_sync_from_vapic(vcpu); + preempt_enable(); down_read(&vcpu->kvm->slots_lock); @@ -3218,7 +3220,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) if (vcpu->arch.exception.pending && kvm_x86_ops->exception_injected(vcpu)) vcpu->arch.exception.pending = false; - kvm_lapic_sync_from_vapic(vcpu); r = kvm_x86_ops->handle_exit(kvm_run, vcpu); out: