]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.17/0002-KVM-SVM-Handle-MCEs-early-in-the-vmexit-process.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / 0002-KVM-SVM-Handle-MCEs-early-in-the-vmexit-process.patch
CommitLineData
7d777456
GKH
1From 9ce5c64e94beb615d6581e7b8839bb0173903425 Mon Sep 17 00:00:00 2001
2From: Joerg Roedel <joerg.roedel@amd.com>
3Date: Mon, 17 May 2010 14:43:34 +0200
4Subject: KVM: SVM: Handle MCEs early in the vmexit process
5
6This patch moves handling of the MC vmexits to an earlier
7point in the vmexit. The handle_exit function is too late
8because the vcpu might alreadry have changed its physical
9cpu.
10
11Cc: stable@kernel.org
12Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
13Signed-off-by: Avi Kivity <avi@redhat.com>
14(cherry picked from commit fe5913e4e1700cbfc337f4b1da9ddb26f6a55586)
15---
16 arch/x86/kvm/svm.c | 15 ++++++++++++++-
17 1 file changed, 14 insertions(+), 1 deletion(-)
18
19--- a/arch/x86/kvm/svm.c
20+++ b/arch/x86/kvm/svm.c
21@@ -1257,7 +1257,7 @@ static int nm_interception(struct vcpu_s
22 return 1;
23 }
24
25-static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
26+static void svm_handle_mce(struct vcpu_svm *svm)
27 {
28 /*
29 * On an #MC intercept the MCE handler is not called automatically in
30@@ -1267,6 +1267,11 @@ static int mc_interception(struct vcpu_s
31 "int $0x12\n");
32 /* not sure if we ever come back to this point */
33
34+ return;
35+}
36+
37+static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
38+{
39 return 1;
40 }
41
42@@ -2717,6 +2722,14 @@ static void svm_vcpu_run(struct kvm_vcpu
43 vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR);
44 vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR);
45 }
46+
47+ /*
48+ * We need to handle MC intercepts here before the vcpu has a chance to
49+ * change the physical cpu
50+ */
51+ if (unlikely(svm->vmcb->control.exit_code ==
52+ SVM_EXIT_EXCP_BASE + MC_VECTOR))
53+ svm_handle_mce(svm);
54 }
55
56 #undef R