From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751317AbdJWJG1 (ORCPT ); Mon, 23 Oct 2017 05:06:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:51379 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbdJWJG0 (ORCPT ); Mon, 23 Oct 2017 05:06:26 -0400 Subject: Re: [locking/paravirt] 9043442b43: WARNING:at_kernel/jump_label.c:#static_key_disable_cpuslocked To: Borislav Petkov , Peter Zijlstra Cc: Waiman Long , Ingo Molnar , Linus Torvalds , Thomas Gleixner , LKML , "H. Peter Anvin" , tipbuild@zytor.com, lkp@01.org References: <20171011195627.eh6cqiclnxx2cf45@inn> <8ddf11c2-1cf7-c74c-e72a-29a7404370fe@redhat.com> <20171012074717.jejrvn7q4gvyzg43@hirez.programming.kicks-ass.net> <20171018142159.hesobm5arrjvexoj@pd.tnic> From: Juergen Gross Message-ID: Date: Mon, 23 Oct 2017 11:06:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171018142159.hesobm5arrjvexoj@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/10/17 16:22, Borislav Petkov wrote: > On Thu, Oct 12, 2017 at 09:47:17AM +0200, Peter Zijlstra wrote: >> Urgh.. I always get lost in that whole patching maze :/ Unless Juergen >> can move it later, I think the below should also work. Moving >> jump_label_init() before smp_prepare_boot_cpu() might not work for all >> architectures, but it should work for x86 (and we explicitly allow for >> archs to initialize this early). >> >> --- >> arch/x86/kernel/smpboot.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c >> index aed1460135e6..93b42d9d9d4f 100644 >> --- a/arch/x86/kernel/smpboot.c >> +++ b/arch/x86/kernel/smpboot.c >> @@ -1350,6 +1350,17 @@ void __init native_smp_prepare_boot_cpu(void) >> /* already set me in cpu_online_mask in boot_cpu_init() */ >> cpumask_set_cpu(me, cpu_callout_mask); >> cpu_set_state_online(me); >> + >> + /* >> + * native_pv_lock_init() needs jump_labels to work. Moving >> + * jump_label_init() in generic code requires auditing all archs for >> + * their text_poke requirements. >> + * >> + * The x86 version really only depends on ideal_nops[] which is >> + * initialized at the end of setup_arch(). So doing an arch specific >> + * early init of jump-labels here is fine. >> + */ >> + jump_label_init(); >> native_pv_lock_init(); >> } > > This fixes the jump_label thing I'm seeing too but it causes: > > [ 0.000000] ------------[ cut here ]------------ > [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/x86/kernel/alternative.c:712 text_poke+0x214/0x220 Yeah, calling jump_label_init() before page_alloc_init() seems to be the problem. I guess the best solution would be to move the call of native_pv_lock_init() after jump_label_init(). This would require a new hook, e.g. lock_init(), to be called either from start_kernel() or maybe from sched_init()? Juergen