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

[Xen-changelog] [xen-unstable] x86 mca: Be more careful for printk in MCE context



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1264747823 0
# Node ID ebd2495ec073064d5f05754060fdf6ce38b907a3
# Parent  088f1b01d852ebb513f8fb5ed9b457d5f6afe291
x86 mca: 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>
---
 xen/arch/x86/cpu/mcheck/mce.c       |    2 +-
 xen/arch/x86/cpu/mcheck/mce.h       |    6 ++++--
 xen/arch/x86/cpu/mcheck/mce_intel.c |    6 +++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff -r 088f1b01d852 -r ebd2495ec073 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Fri Jan 29 06:49:42 2010 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Fri Jan 29 06:50:23 2010 +0000
@@ -1605,7 +1605,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 088f1b01d852 -r ebd2495ec073 xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h     Fri Jan 29 06:49:42 2010 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce.h     Fri Jan 29 06:50:23 2010 +0000
@@ -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 088f1b01d852 -r ebd2495ec073 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c       Fri Jan 29 06:49:42 2010 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c       Fri Jan 29 06:50:23 2010 +0000
@@ -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);

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


 


Rackspace

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