From patchwork Mon May 17 12:43:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 100104 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4HCiimR023876 for ; Mon, 17 May 2010 12:44:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755290Ab0EQMoP (ORCPT ); Mon, 17 May 2010 08:44:15 -0400 Received: from va3ehsobe001.messaging.microsoft.com ([216.32.180.11]:18840 "EHLO VA3EHSOBE001.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754244Ab0EQMoN (ORCPT ); Mon, 17 May 2010 08:44:13 -0400 Received: from mail198-va3-R.bigfish.com (10.7.14.244) by VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id 8.1.340.0; Mon, 17 May 2010 12:44:12 +0000 Received: from mail198-va3 (localhost.localdomain [127.0.0.1]) by mail198-va3-R.bigfish.com (Postfix) with ESMTP id 7767E126050F; Mon, 17 May 2010 12:44:12 +0000 (UTC) X-SpamScore: -4 X-BigFish: VPS-4(zz936eMab9bhzz1202hzzz32i87h2a8h61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail198-va3 (localhost.localdomain [127.0.0.1]) by mail198-va3 (MessageSwitch) id 1274100239566158_21684; Mon, 17 May 2010 12:43:59 +0000 (UTC) Received: from VA3EHSMHS010.bigfish.com (unknown [10.7.14.242]) by mail198-va3.bigfish.com (Postfix) with ESMTP id 719C5D0815A; Mon, 17 May 2010 12:43:50 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by VA3EHSMHS010.bigfish.com (10.7.99.20) with Microsoft SMTP Server (TLS) id 14.0.482.44; Mon, 17 May 2010 12:43:47 +0000 Received: from ausb3twp01.amd.com (ausb3twp01.amd.com [163.181.250.37]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o4HCjJ9h022727; Mon, 17 May 2010 07:45:22 -0500 X-WSS-ID: 0L2KE0R-01-6W1-02 X-M-MSG: Received: from sausexhtp02.amd.com (sausexhtp02.amd.com [163.181.3.152]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2ADCB1028862; Mon, 17 May 2010 07:43:38 -0500 (CDT) Received: from storexhtp01.amd.com (172.24.4.3) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.2.254.0; Mon, 17 May 2010 07:43:41 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp01.amd.com (172.24.4.3) with Microsoft SMTP Server id 8.2.254.0; Mon, 17 May 2010 08:43:40 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id 0E10D49C1F7; Mon, 17 May 2010 13:43:40 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 41430) id 53BEDC9A45; Mon, 17 May 2010 14:43:40 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , Elsie Wahlig , Bhavna Sarathy , Boris Ostrovsky , Joerg Roedel , Subject: [PATCH 1/2] KVM: SVM: Handle MCEs early in the vmexit process Date: Mon, 17 May 2010 14:43:34 +0200 Message-ID: <1274100215-26467-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1274100215-26467-1-git-send-email-joerg.roedel@amd.com> References: <1274100215-26467-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-Reverse-DNS: ausb3extmailp02.amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 17 May 2010 12:44:44 +0000 (UTC) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index cea916f..f92d191 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1410,7 +1410,7 @@ static int nm_interception(struct vcpu_svm *svm) return 1; } -static int mc_interception(struct vcpu_svm *svm) +static void svm_handle_mce(struct vcpu_svm *svm) { /* * On an #MC intercept the MCE handler is not called automatically in @@ -1420,6 +1420,11 @@ static int mc_interception(struct vcpu_svm *svm) "int $0x12\n"); /* not sure if we ever come back to this point */ + return; +} + +static int mc_interception(struct vcpu_svm *svm) +{ return 1; } @@ -3183,6 +3188,14 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); } + + /* + * We need to handle MC intercepts here before the vcpu has a chance to + * change the physical cpu + */ + if (unlikely(svm->vmcb->control.exit_code == + SVM_EXIT_EXCP_BASE + MC_VECTOR)) + svm_handle_mce(svm); } #undef R