From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754413AbeEaUZ2 (ORCPT ); Thu, 31 May 2018 16:25:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:49410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754089AbeEaUZ1 (ORCPT ); Thu, 31 May 2018 16:25:27 -0400 X-Google-Smtp-Source: ADUXVKJ2zmr0p2KMoKiHjHfj1cpm3HdtAgjen+PuoQS+vOxOl0HDzx3PExhFzs9FU4xk5V46lpVxvDiHm6xieAO8O/E= MIME-Version: 1.0 References: <1527789525-8857-1-git-send-email-chang.seok.bae@intel.com> <1527789525-8857-6-git-send-email-chang.seok.bae@intel.com> In-Reply-To: <1527789525-8857-6-git-send-email-chang.seok.bae@intel.com> From: Andy Lutomirski Date: Thu, 31 May 2018 13:25:12 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2 05/15] x86/vdso: Move out the CPU number store To: "Bae, Chang Seok" Cc: Andrew Lutomirski , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Andi Kleen , Dave Hansen , "Metzger, Markus T" , "Ravi V. Shankar" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 10:58 AM Chang S. Bae wrote: > > The CPU (and node) number will be written, as early enough, > to the segment limit of per CPU data and TSC_AUX MSR entry. > The information has been retrieved by vgetcpu in user space > and will be also loaded from the paranoid entry, when > FSGSBASE enabled. So, it is moved out from vDSO to the CPU > initialization path where IST setup is serialized. > > Now, redundant setting of the segment in entry/vdso/vma.c > was removed; a substantial code removal. It removes a > hotplug notifier, makes a facility useful to both the kernel > and userspace unconditionally available much sooner, and > unification with i386. (Thanks to HPA for suggesting the > cleanup) > > Signed-off-by: Chang S. Bae > Cc: H. Peter Anvin > Cc: Dave Hansen > Cc: Andy Lutomirski > Cc: Andi Kleen > Cc: Thomas Gleixner > Cc: Ingo Molnar > +/* Bit size and mask of CPU number stored in the per CPU data */ > +#define PERCPU_CPU_SIZE 12 > +#define PERCPU_CPU_MASK 0xfff This name is confusing. Maybe LSL_TSCP_CPU_MASK? Can you also add a helpers like: static inline unsigned long make_lsl_tscp(unsigned int cpu, unsigned int node) { ... } static inline unsigned int lsl_tscp_to_cpu(unsigned long x) { ... } static inline unsigned int lsl_tscp_to_node(unsigned long x) { ... } and use them everywhere? This will make it lot easier to understand the code. > +#ifdef CONFIG_X86_32 > + GDT_ENTRY_PERCPU, > +#else /* 64 bit */ > + GDT_ENTRY_PER_CPU, > #endif Please just rename one of these to match the other one.