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

[Xen-devel] [PATCH] Dump mce log by ERST when mc panic



Dump mce log by ERST when mc panic

We have implemented basic ERST logic before. Now linux3.0 as dom0 has included 
APEI logic. Hence it's time to add mce apei interface and enable APEI ERST 
feature.
With it, it can save mce log by ERST method when mc panic.

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>

diff -r ca2f58c2dfea xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Mon Jul 18 21:40:28 2011 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Fri Jul 22 17:02:02 2011 +0800
@@ -919,6 +919,28 @@ void *x86_mcinfo_add(struct mc_info *mi,
     return buf;
 }
 
+static void x86_mcinfo_apei_save(
+    struct mcinfo_global *mc_global, struct mcinfo_bank *mc_bank)
+{
+    struct mce m;
+
+    memset(&m, 0, sizeof(struct mce));
+
+    m.cpu = mc_global->mc_coreid;
+    m.cpuvendor = boot_cpu_data.x86_vendor;
+    m.cpuid = cpuid_eax(1);
+    m.socketid = mc_global->mc_socketid;
+    m.apicid = mc_global->mc_apicid;
+
+    m.mcgstatus = mc_global->mc_gstatus;
+    m.status = mc_bank->mc_status;
+    m.misc = mc_bank->mc_misc;
+    m.addr = mc_bank->mc_addr;
+    m.bank = mc_bank->mc_bank;
+
+    apei_write_mce(&m);
+}
+
 /* Dump machine check information in a format,
  * mcelog can parse. This is used only when
  * Dom0 does not take the notification. */
@@ -962,8 +984,11 @@ void x86_mcinfo_dump(struct mc_info *mi)
             printk("[%16"PRIx64"]", mc_bank->mc_misc);
         if (mc_bank->mc_status & MCi_STATUS_ADDRV)
             printk(" at %16"PRIx64, mc_bank->mc_addr);
+        printk("\n");
 
-        printk("\n");
+        if (is_mc_panic)
+            x86_mcinfo_apei_save(mc_global, mc_bank);
+
     next:
         mic = x86_mcinfo_next(mic); /* next entry */
         if ((mic == NULL) || (mic->size == 0))
diff -r ca2f58c2dfea xen/arch/x86/cpu/mcheck/mce.h
--- a/xen/arch/x86/cpu/mcheck/mce.h     Mon Jul 18 21:40:28 2011 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce.h     Fri Jul 22 17:02:02 2011 +0800
@@ -210,4 +210,6 @@ struct mce {
     __u64 mcgcap;   /* MCGCAP MSR: machine check capabilities of CPU */
 };
 
+extern int apei_write_mce(struct mce *m);
+
 #endif /* _MCE_H */
diff -r ca2f58c2dfea xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c       Mon Jul 18 21:40:28 2011 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c       Fri Jul 22 17:02:02 2011 +0800
@@ -283,6 +283,7 @@ static int mce_delayed_action(mctelem_co
     {
     case MCER_RESET:
         dprintk(XENLOG_ERR, "MCE delayed action failed\n");
+        is_mc_panic = 1;
         x86_mcinfo_dump(mctelem_dataptr(mctc));
         panic("MCE: Software recovery failed for the UCR\n");
         break;

Attachment: mce_erst_2.patch
Description: mce_erst_2.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®.