From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755112AbbFSTCN (ORCPT ); Fri, 19 Jun 2015 15:02:13 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38970 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752866AbbFSTCI (ORCPT ); Fri, 19 Jun 2015 15:02:08 -0400 Date: Fri, 19 Jun 2015 21:02:00 +0200 From: Borislav Petkov To: "Luck, Tony" Cc: "Wang, Rui Y" , "Chen, Gong" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] x86/mce: Initialize workqueues only once (alternate proposal) Message-ID: <20150619190200.GB20546@pd.tnic> References: <20150617094155.GB26661@pd.tnic> <3908561D78D1C84285E8C5FCA982C28F32A9E177@ORSMSX114.amr.corp.intel.com> <20150619092718.GB12979@pd.tnic> <20150619173620.GA9622@agluck-desk.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150619173620.GA9622@agluck-desk.sc.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 19, 2015 at 10:36:20AM -0700, Luck, Tony wrote: > 96d98bfd0366 ("x86/mce: Don't use percpu workqueues") dropped the > per-CPU workqueues in the MCE code but left the initialization per-CPU. > This lead to early boot time splats (below) in the workqueues code > because we were overwriting the workqueue during INIT_WORK() on each new > CPU which would appear. > > Move initialization to mcheck_init() so it happens only once. > > mce: [Hardware Error]: Machine check events logged > BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 > IP: [] process_one_work+0x31/0x420 > PGD 0 > Oops: 0000 [#1] SMP > Modules linked in: > CPU: 36 PID: 263 Comm: kworker/36:0 Not tainted 4.1.0-rc8 #1 > Hardware name: Intel Corporation BRICKLAND/BRICKLAND, BIOS BRHSXSD1.86B.0065.R01.1505011640 > +05/01/2015 > task: ffff88181c284470 ti: ffff88181bd94000 task.ti: ffff88181bd94000 > RIP: 0010:[] process_one_work+0x31/0x420 > RSP: 0000:ffff88181bd97e08 EFLAGS: 00010046 > RAX: 0000000fffffffe0 RBX: ffffffff81d0fa20 RCX: 0000000000000000 > RDX: 0000000fffffff00 RSI: ffffffff81d0fa20 RDI: ffff88181c2660c0 > RBP: ffff88181bd97e48 R08: ffff88181f416ec0 R09: ffff88181c284470 > R10: 0000000000000002 R11: ffffffff8109e5ac R12: ffff88181c2660c0 > R13: ffff88181f416ec0 R14: 0000000000000000 R15: ffff88181c2660f0 > ^^^^^^^^^^^^^^^^^ > > 27: 4c 0f 45 f2 cmovne %rdx,%r14 > 2b:* 49 8b 46 08 mov 0x8(%r14),%rax <-- trapping instruction > 2f: 44 8b b8 00 01 00 00 mov 0x100(%rax),%r15d > > ... > > Call Trace: > worker_thread > ? rescuer_thread > kthread > ? kthread_create_on_node > ret_from_fork > ? kthread_create_on_node > Code: 48 89 e5 41 57 41 56 45 31 f6 41 55 41 54 49 89 fc 53 48 89 f3 48 83 ec 18 48 8b 06 4c > +8b 6f 48 48 89 c2 30 d2 a8 04 4c 0f 45 f2 <49> 8b 46 08 44 8b b8 00 01 00 00 41 c1 ef 05 44 > +89 f8 83 e0 01 > RIP [] process_one_work > RSP > CR2: 0000000000000008 > ---[ end trace 8229a011b97532a0 ]--- > Kernel panic - not syncing: Fatal exception > ---[ end Kernel panic - not syncing: Fatal exception > > Reported-by: Rui Wang > Debugged-by: Borislav Petkov > Signed-off-by: Tony Luck > --- > arch/x86/kernel/cpu/mcheck/mce.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c > index 478f81a6d824..158d9e7db974 100644 > --- a/arch/x86/kernel/cpu/mcheck/mce.c > +++ b/arch/x86/kernel/cpu/mcheck/mce.c > @@ -1665,9 +1665,6 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c) > return; > } > > - INIT_WORK(&mce_work, mce_process_work); > - init_irq_work(&mce_irq_work, mce_irq_work_cb); > - > machine_check_vector = do_machine_check; > > __mcheck_cpu_init_generic(); > @@ -1994,6 +1991,9 @@ int __init mcheck_init(void) > mce_register_decode_chain(&mce_srao_nb); > mcheck_vendor_init_severity(); > > + INIT_WORK(&mce_work, mce_process_work); > + init_irq_work(&mce_irq_work, mce_irq_work_cb); > + > return 0; Hmm, and I was under the impression that mcheck_init() runs much later... Not really. Anyway, your version is better, I've replaced mine with it. Thanks. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/