[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 6/6] MCE: Be more careful for printk in MCE context



Be more careful for printk in MCE context

MCE may happen in printk context, and will cause deadlock if we try to call 
printk again in MCE context.

A new level(mce_critical) is added to mce_verbosity for printk in mce context. 
This level is only for developer that aware of such issue.
In mce_panic, force console unlock.

Singed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>

diff -r 9b31dd6deff7 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Wed Jan 27 20:39:09 2010 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Wed Jan 27 20:39:19 2010 +0800
@@ -1606,7 +1606,7 @@ void mc_panic(char *s)
 void mc_panic(char *s)
 {
     is_mc_panic = 1;
-    console_start_sync();
+    console_force_unlock();
     printk("Fatal machine check: %s\n", s);
     printk("\n"
            "****************************************\n"
diff -r 9b31dd6deff7 xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h     Wed Jan 27 20:39:09 2010 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce.h     Wed Jan 27 20:39:19 2010 +0800
@@ -12,8 +12,10 @@
 #include "x86_mca.h"
 #include "mctelem.h"
 
-#define MCE_QUIET 0
-#define MCE_VERBOSE 1
+#define MCE_QUIET       0
+#define MCE_VERBOSE     1
+/* !only for developer debug as printk is unsafe in MCE context */
+#define MCE_CRITICAL    2
 
 extern int mce_verbosity;
 /* Define the default level of machine check related print.
diff -r 9b31dd6deff7 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c       Wed Jan 27 20:39:09 2010 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c       Wed Jan 27 20:39:19 2010 +0800
@@ -687,7 +687,7 @@ static void intel_machine_check(struct c
         }
         atomic_set(&found_error, 1);
 
-        mce_printk(MCE_VERBOSE, "MCE: clear_bank map %lx on CPU%d\n",
+        mce_printk(MCE_CRITICAL, "MCE: clear_bank map %lx on CPU%d\n",
                 *((unsigned long*)clear_bank), smp_processor_id());
         mcheck_mca_clearbanks(clear_bank);
        /* Print MCE error */
@@ -714,13 +714,13 @@ static void intel_machine_check(struct c
     /* Clear error finding flags after all cpus finishes above judgement */
     mce_barrier_enter(&mce_trap_bar);
     if (atomic_read(&found_error)) {
-        mce_printk(MCE_VERBOSE, "MCE: Choose one CPU "
+        mce_printk(MCE_CRITICAL, "MCE: Choose one CPU "
                        "to clear error finding flag\n ");
         atomic_set(&found_error, 0);
     }
     mca_rdmsrl(MSR_IA32_MCG_STATUS, gstatus);
     if ((gstatus & MCG_STATUS_MCIP) != 0) {
-        mce_printk(MCE_VERBOSE, "MCE: Clear MCIP@ last step");
+        mce_printk(MCE_CRITICAL, "MCE: Clear MCIP@ last step");
         mca_wrmsrl(MSR_IA32_MCG_STATUS, gstatus & ~MCG_STATUS_MCIP);
     }
     mce_barrier_exit(&mce_trap_bar);


Attachment: mce_printk.patch
Description: mce_printk.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.