提交 29b0f591 编写于 作者: A Andi Kleen 提交者: H. Peter Anvin

x86, mce: default to panic timeout for machine checks

Fatal machine checks can be logged to disk after boot, but only if
the system did a warm reboot. That's unfortunately difficult with the
default panic behaviour, which waits forever and the admin has to
press the power button because modern systems usually miss a reset button.
This clears the machine checks in the registers and make
it impossible to log them.

This patch changes the default for machine check panic to always
reboot after 30s. Then the mce can be successfully logged after
reboot.

I believe this will improve machine check experience for any
system running the X server.

This is dependent on successfull boot logging of MCEs. This currently
only works on Intel systems, on AMD there are quite a lot of systems
around which leave junk in the machine check registers after boot,
so it's disabled here. These systems will continue to default
to endless waiting panic.

v2: Only force panic timeout when it's shorter (H.Seto)
v3: Only force timeout when there is no timeout
(based on comment H.Seto)

[ Fix changelog - HS ]
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>
上级 1b2797dc
...@@ -82,6 +82,7 @@ static unsigned long notify_user; ...@@ -82,6 +82,7 @@ static unsigned long notify_user;
static int rip_msr; static int rip_msr;
static int mce_bootlog = -1; static int mce_bootlog = -1;
static int monarch_timeout = -1; static int monarch_timeout = -1;
static int mce_panic_timeout;
static char trigger[128]; static char trigger[128];
static char *trigger_argv[2] = { trigger, NULL }; static char *trigger_argv[2] = { trigger, NULL };
...@@ -216,6 +217,8 @@ static void wait_for_panic(void) ...@@ -216,6 +217,8 @@ static void wait_for_panic(void)
local_irq_enable(); local_irq_enable();
while (timeout-- > 0) while (timeout-- > 0)
udelay(1); udelay(1);
if (panic_timeout == 0)
panic_timeout = mce_panic_timeout;
panic("Panicing machine check CPU died"); panic("Panicing machine check CPU died");
} }
...@@ -253,6 +256,8 @@ static void mce_panic(char *msg, struct mce *final, char *exp) ...@@ -253,6 +256,8 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
printk(KERN_EMERG "Some CPUs didn't answer in synchronization\n"); printk(KERN_EMERG "Some CPUs didn't answer in synchronization\n");
if (exp) if (exp)
printk(KERN_EMERG "Machine check: %s\n", exp); printk(KERN_EMERG "Machine check: %s\n", exp);
if (panic_timeout == 0)
panic_timeout = mce_panic_timeout;
panic(msg); panic(msg);
} }
...@@ -1117,6 +1122,8 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c) ...@@ -1117,6 +1122,8 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c)
} }
if (monarch_timeout < 0) if (monarch_timeout < 0)
monarch_timeout = 0; monarch_timeout = 0;
if (mce_bootlog != 0)
mce_panic_timeout = 30;
} }
static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c) static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册