From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932287AbdJYG61 (ORCPT ); Wed, 25 Oct 2017 02:58:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:36178 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328AbdJYG60 (ORCPT ); Wed, 25 Oct 2017 02:58:26 -0400 Subject: Re: [PATCH] paravirt/locks: avoid modifying static key before jump_label_init() To: Dou Liyang , linux-kernel@vger.kernel.org, x86@kernel.org Cc: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, arnd@arndb.de, peterz@infradead.org References: <20171023134948.24886-1-jgross@suse.com> From: Juergen Gross Message-ID: <7223e00c-0fe6-8844-d0f2-a7cabfba9c03@suse.com> Date: Wed, 25 Oct 2017 08:58:22 +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: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/10/17 06:26, Dou Liyang wrote: > Hi Juergen, > > At 10/23/2017 09:49 PM, Juergen Gross wrote: >> Don't try to set the static virt_spin_lock_key to a value before >> jump_label_init() has been called, as this will result in a WARN(). >> >> Solve the problem by introducing a new lock_init() hook called after >> jump_label_init() instead of doing the call inside of >> smp_prepare_boot_cpu(). >> >> Signed-off-by: Juergen Gross >> --- >> Based on kernel/git/tip/tip.git locking/core > > I also found that WARN() in tip tree. > > IMO, adding a hook in start_kernel() is not elegant. It will > affect other arches and increase the complexity of the system. > > I like your original method. > So, I try to fix it by moving the native_pv_lock_init() from >  native_smp_prepare_boot_cpu() to native_smp_prepare_cpus(). Hmm, this might work, but the Xen case has to be modified (same for my more general solution), as xen_init_spinlocks() is still modifying the static key too early. And we can't move xen_init_spinlocks() to smp_prepare_cpus() as this would be too late for the alternatives patching. So let me extend your patch a little bit to cover Xen, too. > I hope it's useful to you. It really is, thanks. Juergen