Skip to content

Commit

Permalink
KVM: SVM: Handle MCEs early in the vmexit process
Browse files Browse the repository at this point in the history
This patch moves handling of the MC vmexits to an earlier
point in the vmexit. The handle_exit function is too late
because the vcpu might alreadry have changed its physical
cpu.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed Jun 9, 2010
1 parent a06cdb5 commit fe5913e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down Expand Up @@ -3088,6 +3093,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
Expand Down

0 comments on commit fe5913e

Please sign in to comment.