From: Borislav Petkov <bp@suse.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>, X86-ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
ashok.raj@intel.com, gong.chen@linux.intel.com,
Borislav Petkov <bp@suse.de>
Subject: [PATCH 4/7] x86/mce: Avoid potential deadlock due to printk() in MCE context
Date: Thu, 16 Jul 2015 09:44:18 +0200 [thread overview]
Message-ID: <1437032661-15521-4-git-send-email-bp@suse.de> (raw)
In-Reply-To: <1437032661-15521-1-git-send-email-bp@suse.de>
From: "Chen, Gong" <gong.chen@linux.intel.com>
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 to do so.
[Tony: Folded in subsequent patch from Boris for early boot logging]
Reported-by: Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: Chen, Gong <gong.chen@linux.intel.com>
Link: http://lkml.kernel.org/r/1432150538-3120-5-git-send-email-gong.chen@linux.intel.com
[ Boris: kick irq_work in mce_log() directly. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
arch/x86/kernel/cpu/mcheck/mce-apei.c | 1 -
arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
arch/x86/kernel/cpu/mcheck/mce_intel.c | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-apei.c b/arch/x86/kernel/cpu/mcheck/mce-apei.c
index a1aef9533154..34c89a3e8260 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-apei.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-apei.c
@@ -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;
mce_log(&m);
- mce_notify_irq();
}
EXPORT_SYMBOL_GPL(apei_mce_report_mem_error);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index a76d3251cadf..b5214fc58920 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -159,7 +159,8 @@ void mce_log(struct mce *mce)
/* Emit the trace record: */
trace_mce_record(mce);
- atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
+ if (mce_genpool_add(mce))
+ irq_work_queue(&mce_irq_work);
mce->finished = 0;
wmb();
@@ -1122,7 +1123,6 @@ void do_machine_check(struct pt_regs *regs, long error_code)
/* assuming valid severity level != 0 */
m.severity = severity;
m.usable_addr = mce_usable_address(&m);
- mce_genpool_add(&m);
mce_log(&m);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 844f56c5616d..70f567f774ed 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -246,7 +246,6 @@ static void intel_threshold_interrupt(void)
return;
machine_check_poll(MCP_TIMESTAMP, this_cpu_ptr(&mce_banks_owned));
- mce_notify_irq();
}
/*
--
1.9.0.258.g00eda23
next prev parent reply other threads:[~2015-07-16 7:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 21:57 [GIT PULL] x86/ras material for 4.3 queue Luck, Tony
2015-07-15 11:30 ` Ingo Molnar
2015-07-16 7:39 ` Borislav Petkov
2015-07-16 7:44 ` [PATCH 1/7] x86/mce: Provide a lockless memory pool to save error records Borislav Petkov
2015-07-16 7:44 ` [PATCH 2/7] x86/mce: Don't use percpu workqueues Borislav Petkov
2015-07-16 7:44 ` [PATCH 3/7] x86/mce: Remove the MCE ring for Action Optional errors Borislav Petkov
2015-07-16 7:44 ` Borislav Petkov [this message]
2015-07-16 7:44 ` [PATCH 5/7] x86/mce: Kill drain_mcelog_buffer() Borislav Petkov
2015-07-16 7:44 ` [PATCH 6/7] x86/mce: Remove unused function declarations Borislav Petkov
2015-07-16 7:44 ` [PATCH 7/7] x86/mce: Clear Local MCE opt-in before kexec Borislav Petkov
2015-07-17 1:16 ` Andy Lutomirski
2015-07-17 4:52 ` Raj, Ashok
2015-07-21 8:29 ` [PATCH 1/7] x86/mce: Provide a lockless memory pool to save error records Ingo Molnar
2015-07-21 10:03 ` Borislav Petkov
2015-07-21 10:08 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437032661-15521-4-git-send-email-bp@suse.de \
--to=bp@suse.de \
--cc=ashok.raj@intel.com \
--cc=gong.chen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®