[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXy0bFxGoUB3rfwyJaM0ab5ZPZR0ku-wnBwfx+P+MaL8A@mail.gmail.com>
Date: Thu, 31 May 2018 13:25:12 -0700
From: Andy Lutomirski <luto@...nel.org>
To: "Bae, Chang Seok" <chang.seok.bae@...el.com>
Cc: Andrew Lutomirski <luto@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"Metzger, Markus T" <markus.t.metzger@...el.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V2 05/15] x86/vdso: Move out the CPU number store
On Thu, May 31, 2018 at 10:58 AM Chang S. Bae <chang.seok.bae@...el.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.bae@...el.com>
> Cc: H. Peter Anvin <hpa@...or.com>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Andi Kleen <ak@...ux.intel.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...nel.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.
Powered by blists - more mailing lists