Commit f29a7aff authored by Chen, Gong's avatar Chen, Gong Committed by Ingo Molnar

x86/mce: Avoid potential deadlock due to printk() in MCE context

Printing in MCE context is a no-no, currently, as printk() is
not NMI-safe. If some of the notifiers on the MCE chain call do
so, we may deadlock. In order to avoid that, delay printk() to
process context where it is safe.
Reported-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarChen, Gong <gong.chen@linux.intel.com>
[ Fold in subsequent patch from Boris for early boot logging. ]
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
[ Kick irq_work in mce_log() directly. ]
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1439396985-12812-6-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent fd4cf79f
...@@ -57,7 +57,6 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err) ...@@ -57,7 +57,6 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err)
m.addr = mem_err->physical_addr; m.addr = mem_err->physical_addr;
mce_log(&m); mce_log(&m);
mce_notify_irq();
} }
EXPORT_SYMBOL_GPL(apei_mce_report_mem_error); EXPORT_SYMBOL_GPL(apei_mce_report_mem_error);
......
...@@ -159,7 +159,8 @@ void mce_log(struct mce *mce) ...@@ -159,7 +159,8 @@ void mce_log(struct mce *mce)
/* Emit the trace record: */ /* Emit the trace record: */
trace_mce_record(mce); trace_mce_record(mce);
atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce); if (!mce_gen_pool_add(mce))
irq_work_queue(&mce_irq_work);
mce->finished = 0; mce->finished = 0;
wmb(); wmb();
...@@ -1122,7 +1123,6 @@ void do_machine_check(struct pt_regs *regs, long error_code) ...@@ -1122,7 +1123,6 @@ void do_machine_check(struct pt_regs *regs, long error_code)
/* assuming valid severity level != 0 */ /* assuming valid severity level != 0 */
m.severity = severity; m.severity = severity;
m.usable_addr = mce_usable_address(&m); m.usable_addr = mce_usable_address(&m);
mce_gen_pool_add(&m);
mce_log(&m); mce_log(&m);
......
...@@ -246,7 +246,6 @@ static void intel_threshold_interrupt(void) ...@@ -246,7 +246,6 @@ static void intel_threshold_interrupt(void)
return; return;
machine_check_poll(MCP_TIMESTAMP, this_cpu_ptr(&mce_banks_owned)); machine_check_poll(MCP_TIMESTAMP, this_cpu_ptr(&mce_banks_owned));
mce_notify_irq();
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment