From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751392AbdJ2MPo (ORCPT ); Sun, 29 Oct 2017 08:15:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:34211 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbdJ2MPj (ORCPT ); Sun, 29 Oct 2017 08:15:39 -0400 Subject: Re: [PATCH][tip] x86/paravirt: Make the virt_spin_lock_key setup after jump_label_init() To: Borislav Petkov Cc: Vitaly Kuznetsov , Dou Liyang , linux-kernel@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, boris.ostrovsky@oracle.com, luto@kernel.org References: <1509120120-5386-1-git-send-email-douly.fnst@cn.fujitsu.com> <87bmkszfeb.fsf@vitty.brq.redhat.com> <5c60e12c-1900-cf45-0db9-e5b67b0920d2@suse.com> <20171028105546.67mlbqfjv3g562v7@pd.tnic> From: Juergen Gross Message-ID: Date: Sun, 29 Oct 2017 13:15:34 +0100 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: <20171028105546.67mlbqfjv3g562v7@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/10/17 12:55, Borislav Petkov wrote: > On Fri, Oct 27, 2017 at 07:25:04PM +0200, Juergen Gross wrote: >>>> This is assuming CPU 0 is the boot cpu. I think you want boot_cpu_data.cpu_index here or whatever is used on xen to identify the BSP reliably. >>> >>> It seems both PV and PVHVM call xen_init_lock_cpu(0) so 0 here is >>> Linux's idea of CPU id, not Xen's. >>> >>> In case Xen's idea is needed xen_vcpu_id mapping should be used. But I >>> don't think it's the case here. >>> >> >> Correct. > > If it is Linux's idea of the BSP, then you need to check against > boot_cpu_data.cpu_index. The idea is to set the static key on the first call of xen_init_lock_cpu(). As this first call is done with 0 as parameter the correct check is against 0. Juergen