提交 8ee08347 编写于 作者: A Andi Kleen 提交者: H. Peter Anvin

x86, mce: extend struct mce user interface with more information.

Experience has shown that struct mce which is used to pass an machine
check to the user space daemon currently a few limitations.  Also some
data which is useful to print at panic level is also missing.

This patch addresses most of them. The same information is also
printed out together with mce panic.

struct mce can be painlessly extended in a compatible way, the mcelog
user space code just ignores additional fields with a warning.

- It doesn't provide a wall time timestamp. There have been a few
  complaints about that. Fix that by adding a 64bit time_t

- It doesn't provide the exact CPU identification. This makes
  it awkward for mcelog to decode the event correctly, especially
  when there are variations in the supported MCE codes on different
  CPU models or when mcelog is running on a different host after a panic.
  Previously the administrator had to specify the correct CPU
  when mcelog ran on a different host, but with the more variation
  in machine checks now it's better to auto detect that.
  It's also useful for more detailed analysis of CPU events.
  Pass CPUID 1.EAX and the cpu vendor (as encoded in processor.h) instead.

- Socket ID and initial APIC ID are useful to report because they
  allow to identify the failing CPU in some (not all) cases.
  This is also especially useful for the panic situation.
  This addresses one of the complaints from Thomas Gleixner earlier.

- The MCG capabilities MSR needs to be reported for some advanced
  error processing in mcelog
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
上级 d620c67f
...@@ -36,13 +36,19 @@ struct mce { ...@@ -36,13 +36,19 @@ struct mce {
__u64 mcgstatus; __u64 mcgstatus;
__u64 ip; __u64 ip;
__u64 tsc; /* cpu time stamp counter */ __u64 tsc; /* cpu time stamp counter */
__u64 res1; /* for future extension */ __u64 time; /* wall time_t when error was detected */
__u64 res2; /* dito. */ __u8 cpuvendor; /* cpu vendor as encoded in system.h */
__u8 pad1;
__u16 pad2;
__u32 cpuid; /* CPUID 1 EAX */
__u8 cs; /* code segment */ __u8 cs; /* code segment */
__u8 bank; /* machine check bank */ __u8 bank; /* machine check bank */
__u8 cpu; /* cpu number; obsolete; use extcpu now */ __u8 cpu; /* cpu number; obsolete; use extcpu now */
__u8 finished; /* entry is valid */ __u8 finished; /* entry is valid */
__u32 extcpu; /* linux cpu number that detected the error */ __u32 extcpu; /* linux cpu number that detected the error */
__u32 socketid; /* CPU socket ID */
__u32 apicid; /* CPU initial apic ID */
__u64 mcgcap; /* MCGCAP MSR: machine check capabilities of CPU */
}; };
/* /*
......
...@@ -96,6 +96,15 @@ void mce_setup(struct mce *m) ...@@ -96,6 +96,15 @@ void mce_setup(struct mce *m)
memset(m, 0, sizeof(struct mce)); memset(m, 0, sizeof(struct mce));
m->cpu = m->extcpu = smp_processor_id(); m->cpu = m->extcpu = smp_processor_id();
rdtscll(m->tsc); rdtscll(m->tsc);
/* We hope get_seconds stays lockless */
m->time = get_seconds();
m->cpuvendor = boot_cpu_data.x86_vendor;
m->cpuid = cpuid_eax(1);
#ifdef CONFIG_SMP
m->socketid = cpu_data(m->extcpu).phys_proc_id;
#endif
m->apicid = cpu_data(m->extcpu).initial_apicid;
rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap);
} }
DEFINE_PER_CPU(struct mce, injectm); DEFINE_PER_CPU(struct mce, injectm);
...@@ -173,6 +182,9 @@ static void print_mce(struct mce *m) ...@@ -173,6 +182,9 @@ static void print_mce(struct mce *m)
if (m->misc) if (m->misc)
printk("MISC %llx ", m->misc); printk("MISC %llx ", m->misc);
printk("\n"); printk("\n");
printk(KERN_EMERG "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n",
m->cpuvendor, m->cpuid, m->time, m->socketid,
m->apicid);
printk(KERN_EMERG "This is not a software problem!\n"); printk(KERN_EMERG "This is not a software problem!\n");
printk(KERN_EMERG "Run through mcelog --ascii to decode " printk(KERN_EMERG "Run through mcelog --ascii to decode "
"and contact your hardware vendor\n"); "and contact your hardware vendor\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册