On Thu, May 31, 2018 at 10:58 AM Chang S. Bae <chang.seok....@intel.com> 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 <chang.seok....@intel.com> > Cc: H. Peter Anvin <h...@zytor.com> > Cc: Dave Hansen <dave.han...@linux.intel.com> > Cc: Andy Lutomirski <l...@kernel.org> > Cc: Andi Kleen <a...@linux.intel.com> > Cc: Thomas Gleixner <t...@linutronix.de> > Cc: Ingo Molnar <mi...@kernel.org>
> +/* 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.