From patchwork Wed Jul 29 12:56:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 38137 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 n6TD1goR014016 for ; Wed, 29 Jul 2009 13:01:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754850AbZG2M77 (ORCPT ); Wed, 29 Jul 2009 08:59:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754806AbZG2M5Q (ORCPT ); Wed, 29 Jul 2009 08:57:16 -0400 Received: from outbound-dub.frontbridge.com ([213.199.154.16]:33812 "EHLO IE1EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754779AbZG2M5A (ORCPT ); Wed, 29 Jul 2009 08:57:00 -0400 Received: from mail97-dub-R.bigfish.com (10.5.252.3) by IE1EHSOBE001.bigfish.com (10.5.252.21) with Microsoft SMTP Server id 8.1.340.0; Wed, 29 Jul 2009 12:57:00 +0000 Received: from mail97-dub (localhost.localdomain [127.0.0.1]) by mail97-dub-R.bigfish.com (Postfix) with ESMTP id A60FD1C181A6; Wed, 29 Jul 2009 12:56:59 +0000 (UTC) X-SpamScore: 3 X-BigFish: VPS3(zzzz1202hzzz32i203h43j62h) X-Spam-TCS-SCL: 1:0 Received: by mail97-dub (MessageSwitch) id 1248872217715619_2542; Wed, 29 Jul 2009 12:56:57 +0000 (UCT) Received: from svlb1extmailp02.amd.com (unknown [139.95.251.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail97-dub.bigfish.com (Postfix) with ESMTP id EC9D2C90055; Wed, 29 Jul 2009 12:56:56 +0000 (UTC) Received: from svlb1twp02.amd.com ([139.95.250.35]) by svlb1extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n6TCup4U009020; Wed, 29 Jul 2009 05:56:54 -0700 X-WSS-ID: 0KNJNYC-04-3ZV-01 Received: from SSVLEXBH1.amd.com (ssvlexbh1.amd.com [139.95.53.182]) by svlb1twp02.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 2F3E01103BD; Wed, 29 Jul 2009 05:56:35 -0700 (PDT) Received: from ssvlexmb2.amd.com ([139.95.53.7]) by SSVLEXBH1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 05:56:41 -0700 Received: from SF30EXMB1.amd.com ([172.20.6.49]) by ssvlexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 05:56:40 -0700 Received: from seurexmb1.amd.com ([165.204.9.130]) by SF30EXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 14:56:38 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 14:56:36 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 68FC1C9B28; Wed, 29 Jul 2009 14:56:36 +0200 (CEST) From: Joerg Roedel To: Avi Kivity CC: Alexander Graf , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 06/12] kvm/svm: complete interrupts after handling nested exits Date: Wed, 29 Jul 2009 14:56:26 +0200 Message-ID: <1248872192-30881-7-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1248872192-30881-1-git-send-email-joerg.roedel@amd.com> References: <1248872192-30881-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 29 Jul 2009 12:56:36.0639 (UTC) FILETIME=[01BFDAF0:01CA104C] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The interrupt completion code must run after nested exits are handled because not injected interrupts or exceptions may be handled by the l1 guest first. Signed-off-by: Joerg Roedel Acked-by: Alexander Graf --- arch/x86/kvm/svm.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 0a0b3e1..1756a4c 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -118,6 +118,7 @@ static int nested = 0; module_param(nested, int, S_IRUGO); static void svm_flush_tlb(struct kvm_vcpu *vcpu); +static void svm_complete_interrupts(struct vcpu_svm *svm); static int nested_svm_exit_handled(struct vcpu_svm *svm, bool kvm_override); static int nested_svm_vmexit(struct vcpu_svm *svm); @@ -2329,6 +2330,8 @@ static int handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) } } + svm_complete_interrupts(svm); + if (npt_enabled) { int mmu_reload = 0; if ((vcpu->arch.cr0 ^ svm->vmcb->save.cr0) & X86_CR0_PG) { @@ -2695,8 +2698,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); } - - svm_complete_interrupts(svm); } #undef R