debuggers.hg

changeset 20912:ebd2495ec073

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@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jan 29 06:50:23 2010 +0000 (2010-01-29)
parents 088f1b01d852
children 8dcedf17b5b4
files xen/arch/x86/cpu/mcheck/mce.c xen/arch/x86/cpu/mcheck/mce.h xen/arch/x86/cpu/mcheck/mce_intel.c
line diff
     1.1 --- a/xen/arch/x86/cpu/mcheck/mce.c	Fri Jan 29 06:49:42 2010 +0000
     1.2 +++ b/xen/arch/x86/cpu/mcheck/mce.c	Fri Jan 29 06:50:23 2010 +0000
     1.3 @@ -1605,7 +1605,7 @@ void set_poll_bankmask(struct cpuinfo_x8
     1.4  void mc_panic(char *s)
     1.5  {
     1.6      is_mc_panic = 1;
     1.7 -    console_start_sync();
     1.8 +    console_force_unlock();
     1.9      printk("Fatal machine check: %s\n", s);
    1.10      printk("\n"
    1.11             "****************************************\n"
     2.1 --- a/xen/arch/x86/cpu/mcheck/mce.h	Fri Jan 29 06:49:42 2010 +0000
     2.2 +++ b/xen/arch/x86/cpu/mcheck/mce.h	Fri Jan 29 06:50:23 2010 +0000
     2.3 @@ -12,8 +12,10 @@
     2.4  #include "x86_mca.h"
     2.5  #include "mctelem.h"
     2.6  
     2.7 -#define MCE_QUIET 0
     2.8 -#define MCE_VERBOSE 1
     2.9 +#define MCE_QUIET       0
    2.10 +#define MCE_VERBOSE     1
    2.11 +/* !only for developer debug as printk is unsafe in MCE context */
    2.12 +#define MCE_CRITICAL    2
    2.13  
    2.14  extern int mce_verbosity;
    2.15  /* Define the default level of machine check related print.
     3.1 --- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Jan 29 06:49:42 2010 +0000
     3.2 +++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Jan 29 06:50:23 2010 +0000
     3.3 @@ -687,7 +687,7 @@ static void intel_machine_check(struct c
     3.4          }
     3.5          atomic_set(&found_error, 1);
     3.6  
     3.7 -        mce_printk(MCE_VERBOSE, "MCE: clear_bank map %lx on CPU%d\n",
     3.8 +        mce_printk(MCE_CRITICAL, "MCE: clear_bank map %lx on CPU%d\n",
     3.9                  *((unsigned long*)clear_bank), smp_processor_id());
    3.10          mcheck_mca_clearbanks(clear_bank);
    3.11         /* Print MCE error */
    3.12 @@ -714,13 +714,13 @@ static void intel_machine_check(struct c
    3.13      /* Clear error finding flags after all cpus finishes above judgement */
    3.14      mce_barrier_enter(&mce_trap_bar);
    3.15      if (atomic_read(&found_error)) {
    3.16 -        mce_printk(MCE_VERBOSE, "MCE: Choose one CPU "
    3.17 +        mce_printk(MCE_CRITICAL, "MCE: Choose one CPU "
    3.18  		        "to clear error finding flag\n ");
    3.19          atomic_set(&found_error, 0);
    3.20      }
    3.21      mca_rdmsrl(MSR_IA32_MCG_STATUS, gstatus);
    3.22      if ((gstatus & MCG_STATUS_MCIP) != 0) {
    3.23 -        mce_printk(MCE_VERBOSE, "MCE: Clear MCIP@ last step");
    3.24 +        mce_printk(MCE_CRITICAL, "MCE: Clear MCIP@ last step");
    3.25          mca_wrmsrl(MSR_IA32_MCG_STATUS, gstatus & ~MCG_STATUS_MCIP);
    3.26      }
    3.27      mce_barrier_exit(&mce_trap_bar);