From patchwork Wed Oct 7 14:31:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 52285 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 n97EnQTk022521 for ; Wed, 7 Oct 2009 14:49:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759444AbZJGOdJ (ORCPT ); Wed, 7 Oct 2009 10:33:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759443AbZJGOdH (ORCPT ); Wed, 7 Oct 2009 10:33:07 -0400 Received: from va3ehsobe004.messaging.microsoft.com ([216.32.180.14]:42041 "EHLO VA3EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759430AbZJGOdD (ORCPT ); Wed, 7 Oct 2009 10:33:03 -0400 Received: from mail153-va3-R.bigfish.com (10.7.14.247) by VA3EHSOBE004.bigfish.com (10.7.40.24) with Microsoft SMTP Server id 8.1.340.0; Wed, 7 Oct 2009 14:32:27 +0000 Received: from mail153-va3 (localhost.localdomain [127.0.0.1]) by mail153-va3-R.bigfish.com (Postfix) with ESMTP id B4E3D7482CD; Wed, 7 Oct 2009 14:32:26 +0000 (UTC) X-SpamScore: 3 X-BigFish: VPS3(zzzz1202hzzz32i6bh43j62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, Received: by mail153-va3 (MessageSwitch) id 1254925940775989_28871; Wed, 7 Oct 2009 14:32:20 +0000 (UCT) Received: from VA3EHSMHS036.bigfish.com (unknown [10.7.14.239]) by mail153-va3.bigfish.com (Postfix) with ESMTP id EAA90CF80A4; Wed, 7 Oct 2009 14:31:53 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by VA3EHSMHS036.bigfish.com (10.7.99.46) with Microsoft SMTP Server (TLS) id 14.0.482.32; Wed, 7 Oct 2009 14:31:51 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n97EViF1011386; Wed, 7 Oct 2009 09:31:47 -0500 X-WSS-ID: 0KR5F0V-02-3PB-02 X-M-MSG: Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 2BF77C84F1; Wed, 7 Oct 2009 09:31:43 -0500 (CDT) Received: from sausexmb2.amd.com ([163.181.3.157]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 09:31:47 -0500 Received: from SDRSEXMB1.amd.com ([172.20.3.116]) by sausexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 09:31:46 -0500 Received: from seurexmb1.amd.com ([165.204.9.130]) by SDRSEXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 16:31:36 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 7 Oct 2009 16:31:35 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 1968FC9B90; Wed, 7 Oct 2009 16:31:35 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 03/10] KVM: SVM: Move nested INTR #vmexit into preemtible code Date: Wed, 7 Oct 2009 16:31:21 +0200 Message-ID: <1254925888-13743-4-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1254925888-13743-1-git-send-email-joerg.roedel@amd.com> References: <1254925888-13743-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 07 Oct 2009 14:31:35.0170 (UTC) FILETIME=[DF412E20:01CA475A] MIME-Version: 1.0 X-Reverse-DNS: unknown Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index b6ce1a9..7015680 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1379,8 +1379,14 @@ static inline int nested_svm_intr(struct vcpu_svm *svm) svm->vmcb->control.exit_code = SVM_EXIT_INTR; - if (nested_svm_exit_handled(svm)) { - nsvm_printk("VMexit -> INTR\n"); + if (svm->nested.intercept & 1ULL) { + /* + * The #vmexit can't be emulated here directly because this + * code path runs with irqs and preemtion disabled and a + * #vmexit emulation might sleep. Only set the request bit for + * the #vmexit here. + */ + set_bit(KVM_REQ_VMEXIT, &svm->vcpu.requests); return 1; } @@ -2859,6 +2865,13 @@ static bool svm_gb_page_enable(void) return true; } +static void svm_emulate_vmexit(struct kvm_vcpu *vcpu) +{ + struct vcpu_svm *svm = to_svm(vcpu); + + nested_svm_vmexit(svm); +} + static struct kvm_x86_ops svm_x86_ops = { .cpu_has_kvm_support = has_svm, .disabled_by_bios = is_disabled, @@ -2923,6 +2936,7 @@ static struct kvm_x86_ops svm_x86_ops = { .exit_reasons_str = svm_exit_reasons_str, .gb_page_enable = svm_gb_page_enable, + .emulate_vmexit = svm_emulate_vmexit, }; static int __init svm_init(void)