WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "Frank.Vanderlinden@xxxxxxx" <Frank.Vanderlinden@xxxxxxx>
Subject: [Xen-devel] [PATCH 6/6] MCE: Be more careful for printk in MCE context
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Thu, 28 Jan 2010 13:56:04 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Wed, 27 Jan 2010 21:57:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acqf3pOkFu2GugNRSauwuY6Smcjkiw==
Thread-topic: [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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 6/6] MCE: Be more careful for printk in MCE context, Jiang, Yunhong <=