> Hohum, __raw_spin_lock_irqsave does preempt_disable(). And > machine_check_poll should be running in irq context so why would the > original issue happen? > >> kernel: [ 7.341085] BUG: using __this_cpu_write() in preemptible [00000000] code: modprobe/546 > > Unfortunately, I have only one line in a mail CCed to me. > > Color me confused. Is this just the missing put_cpu() that Chen Gong already sent a patch for? See attached -Tony
--- Begin Message ---
- Subject: [PATCH 1/2 v2] x86, MCE: Fix a bug in CMCI handler
- From: "Chen, Gong" <gong.chen@xxxxxxxxxxxxxxx>
- Date: Thu, 17 Apr 2014 06:28:35 +0000
- Cc: "rostedt@xxxxxxxxxxx" <rostedt@xxxxxxxxxxx>, "linux-acpi@xxxxxxxxxxxxxxx" <linux-acpi@xxxxxxxxxxxxxxx>, "arozansk@xxxxxxxxxx" <arozansk@xxxxxxxxxx>, "Chen, Gong" <gong.chen@xxxxxxxxxxxxxxx>
- In-reply-to: <1397716119-6164-1-git-send-email-gong.chen@linux.intel.com>
- Thread-index: AQHPWgnV3hN7Xfr8eUyImTNDowSD+g==
- Thread-topic: [PATCH 1/2 v2] x86, MCE: Fix a bug in CMCI handler
This bug is introduced by me in commit 27f6c573e0. I forget to execute put_cpu_var operation after get_cpu_var. Fix it via this_cpu_write instead of get_cpu_var. v2 -> v1: Separate cleanup from bug fix. Signed-off-by: Chen, Gong <gong.chen@xxxxxxxxxxxxxxx> Suggested-by: H. Peter Anvin <hpa@xxxxxxxxx> --- arch/x86/kernel/cpu/mcheck/mce.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index eeee23f..68317c8 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -598,7 +598,6 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) { struct mce m; int i; - unsigned long *v; this_cpu_inc(mce_poll_count); @@ -618,8 +617,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) if (!(m.status & MCI_STATUS_VAL)) continue; - v = &get_cpu_var(mce_polled_error); - set_bit(0, v); + this_cpu_write(mce_polled_error, 1); /* * Uncorrected or signalled events are handled by the exception * handler when it is enabled, so don't process those here. -- 1.9.0
--- End Message ---
![]() |