]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
x86/mce: CPU notifiers must not be registered a second time during resume
authorJan Beulich <jbeulich@novell.com>
Fri, 18 Mar 2011 17:20:57 +0000 (17:20 +0000)
committerJan Beulich <jbeulich@novell.com>
Fri, 18 Mar 2011 17:20:57 +0000 (17:20 +0000)
While c/s 22964:f71212f712fd and 23051:93c864c16ab1 fixed issues with
CPU onlining, they introduced a problem with resume: mcheck_init() is
also being called on that path, and hence checking whether it's
running on CPU 0, which is generally not a really good thing, is
particularly inappropriate here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset:   23060:b59e98bc6ff1
xen-unstable date:        Fri Mar 18 17:15:19 2011 +0000

xen/arch/x86/acpi/power.c
xen/arch/x86/cpu/common.c
xen/arch/x86/cpu/mcheck/mce.c
xen/arch/x86/cpu/mcheck/mce.h
xen/arch/x86/cpu/mcheck/mce_intel.c
xen/include/asm-x86/processor.h

index 5dfdeb431f912fdc0c48fe9f42072e219951c59b..935c9a1101687255bfda5257e3db270e5985750a 100644 (file)
@@ -187,7 +187,7 @@ static int enter_state(u32 state)
 
     device_power_up();
 
-    mcheck_init(&boot_cpu_data);
+    mcheck_init(&boot_cpu_data, 0);
     write_cr4(cr4);
 
     printk(XENLOG_INFO "Finishing wakeup from ACPI S%d state.\n", state);
index 9223075691de7f0adb4605e38d720060a930626d..8c5ec06cafaba17501d4dfa4baa436fc39798b1f 100644 (file)
@@ -466,19 +466,13 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
                /* AND the already accumulated flags with these */
                for ( i = 0 ; i < NCAPINTS ; i++ )
                        boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
-       }
-
-       /* Init Machine Check Exception if available. */
-       mcheck_init(c);
 
-#if 0
-       if (c == &boot_cpu_data)
-               sysenter_setup();
-       enable_sep_cpu();
-#endif
+               mcheck_init(c, 0);
+       } else {
+               mcheck_init(c, 1);
 
-       if (c == &boot_cpu_data)
                mtrr_bp_init();
+       }
 }
 
 /* cpuid returns the value latched in the HW at reset, not the APIC ID
index 0b7458a87e97a3b0fba089b46bcdafd0fb4a05a7..5e0a6a28663f6f52d6e123092792b4043e2ba6ba 100644 (file)
@@ -793,7 +793,7 @@ static struct notifier_block cpu_nfb = {
 };
 
 /* This has to be run for each processor */
-void mcheck_init(struct cpuinfo_x86 *c)
+void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp)
 {
     enum mcheck_type inited = mcheck_none;
 
@@ -822,7 +822,7 @@ void mcheck_init(struct cpuinfo_x86 *c)
         switch (c->x86) {
         case 6:
         case 15:
-            inited = intel_mcheck_init(c);
+            inited = intel_mcheck_init(c, bsp);
             break;
         }
         break;
@@ -844,7 +844,7 @@ void mcheck_init(struct cpuinfo_x86 *c)
     /* Turn on MCE now */
     set_in_cr4(X86_CR4_MCE);
 
-    if ( smp_processor_id() == 0 )
+    if ( bsp )
     {
         /* Early MCE initialisation for BSP. */
         if ( cpu_poll_bankmask_alloc(0) )
index 26ed4d634df3102901ea0cc9856e0c186677b38a..f87fd08481c507adb34c779545e018cd702d3998 100644 (file)
@@ -42,7 +42,7 @@ enum mcheck_type amd_k7_mcheck_init(struct cpuinfo_x86 *c);
 enum mcheck_type amd_k8_mcheck_init(struct cpuinfo_x86 *c);
 enum mcheck_type amd_f10_mcheck_init(struct cpuinfo_x86 *c);
 
-enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c);
+enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
 
 void intel_mcheck_timer(struct cpuinfo_x86 *c);
 void mce_intel_feature_init(struct cpuinfo_x86 *c);
index 8c7634e2d9b1d4549f336f9b1e7bd595a2d1649a..603acf7a82b59f19950cce38c4e5eecec7f31f82 100644 (file)
@@ -1293,9 +1293,9 @@ static struct notifier_block cpu_nfb = {
 };
 
 /* p4/p6 family have similar MCA initialization process */
-enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c)
+enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp)
 {
-    if ( smp_processor_id() == 0 )
+    if ( bsp )
     {
         /* Early MCE initialisation for BSP. */
         if ( cpu_mcabank_alloc(0) )
index b4b3d5cb8bb6810dc9cb979f8633168b90c76efa..128295bff03d90ceb5b4d2177dc2e8bc17104bf2 100644 (file)
@@ -555,7 +555,7 @@ void compat_show_guest_stack(struct vcpu *, struct cpu_user_regs *, int lines);
 extern void mtrr_ap_init(void);
 extern void mtrr_bp_init(void);
 
-void mcheck_init(struct cpuinfo_x86 *c);
+void mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
 
 #define DECLARE_TRAP_HANDLER(_name)                     \
 asmlinkage void _name(void);                            \