|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: vMCE injection
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@xxxxxxxxx>
# Date 1348653910 -7200
# Node ID 8f8fabafec86bd0e5ba65a0c2ea28027eb1278eb
# Parent 08b7e65a5d936bb766f076dde2d026569ad60e4c
x86: vMCE injection
In our test for win8 guest mce, we find a bug that no matter what
SRAO/SRAR error xen inject to win8 guest, it always reboot.
The root cause is, current Xen vMCE logic inject vMCE# only to vcpu0,
this is not correct for Intel MCE (Under Intel arch, h/w generate MCE#
to all CPUs).
This patch fixes vMCE injection bug, injecting vMCE# to all vcpus on
Intel platforms.
Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
- increase flexibility be making new second argument of inject_vmce() a
VCPU ID rather than just a boolean
Acked-by: Christoph Egger <Christoph.Egger@xxxxxxx> (on just this change)
- fix condition evaluation order in inject_vmce()
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
diff -r 08b7e65a5d93 -r 8f8fabafec86 xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h Wed Sep 26 12:04:00 2012 +0200
+++ b/xen/arch/x86/cpu/mcheck/mce.h Wed Sep 26 12:05:10 2012 +0200
@@ -168,7 +168,7 @@ void x86_mcinfo_dump(struct mc_info *mi)
int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct domain *d,
uint64_t gstatus);
-int inject_vmce(struct domain *d);
+int inject_vmce(struct domain *d, int vcpu);
static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr)
{
diff -r 08b7e65a5d93 -r 8f8fabafec86 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c Wed Sep 26 12:04:00 2012 +0200
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c Wed Sep 26 12:05:10 2012 +0200
@@ -359,7 +359,7 @@ static void intel_memerr_dhandler(
}
/* We will inject vMCE to DOMU*/
- if ( inject_vmce(d) < 0 )
+ if ( inject_vmce(d, -1) < 0 )
{
mce_printk(MCE_QUIET, "inject vMCE to DOM%d"
" failed\n", d->domain_id);
diff -r 08b7e65a5d93 -r 8f8fabafec86 xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c Wed Sep 26 12:04:00 2012 +0200
+++ b/xen/arch/x86/cpu/mcheck/vmce.c Wed Sep 26 12:05:10 2012 +0200
@@ -324,51 +324,39 @@ static int vmce_load_vcpu_ctxt(struct do
HVM_REGISTER_SAVE_RESTORE(VMCE_VCPU, vmce_save_vcpu_ctxt,
vmce_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
-int inject_vmce(struct domain *d)
+/*
+ * for Intel MCE, broadcast vMCE to all vcpus
+ * for AMD MCE, only inject vMCE to vcpu0
+ */
+int inject_vmce(struct domain *d, int vcpu)
{
- int cpu = smp_processor_id();
+ struct vcpu *v;
- /* PV guest and HVM guest have different vMCE# injection methods. */
- if ( !test_and_set_bool(d->vcpu[0]->mce_pending) )
+ for_each_vcpu ( d, v )
{
- if ( d->is_hvm )
+ if ( vcpu >= 0 && v->vcpu_id != vcpu )
+ continue;
+
+ if ( (is_hvm_domain(d) ||
+ guest_has_trap_callback(d, v->vcpu_id, TRAP_machine_check)) &&
+ !test_and_set_bool(v->mce_pending) )
{
- mce_printk(MCE_VERBOSE, "MCE: inject vMCE to HVM DOM %d\n",
- d->domain_id);
- vcpu_kick(d->vcpu[0]);
+ mce_printk(MCE_VERBOSE, "MCE: inject vMCE to d%d:v%d\n",
+ d->domain_id, v->vcpu_id);
+ vcpu_kick(v);
}
else
{
- mce_printk(MCE_VERBOSE, "MCE: inject vMCE to PV DOM%d\n",
- d->domain_id);
- if ( guest_has_trap_callback(d, 0, TRAP_machine_check) )
- {
- cpumask_copy(d->vcpu[0]->cpu_affinity_tmp,
- d->vcpu[0]->cpu_affinity);
- mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n",
- cpu, d->vcpu[0]->processor);
- vcpu_set_affinity(d->vcpu[0], cpumask_of(cpu));
- vcpu_kick(d->vcpu[0]);
- }
- else
- {
- mce_printk(MCE_VERBOSE,
- "MCE: Kill PV guest with No MCE handler\n");
- domain_crash(d);
- }
+ mce_printk(MCE_QUIET, "Failed to inject vMCE to d%d:v%d\n",
+ d->domain_id, v->vcpu_id);
+ return -EBUSY;
}
+
+ if ( vcpu >= 0 )
+ return 0;
}
- else
- {
- /* new vMCE comes while first one has not been injected yet,
- * in this case, inject fail. [We can't lose this vMCE for
- * the mce node's consistency].
- */
- mce_printk(MCE_QUIET, "There's a pending vMCE waiting to be injected "
- " to this DOM%d!\n", d->domain_id);
- return -1;
- }
- return 0;
+
+ return v ? -ESRCH : 0;
}
int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct domain *d,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |