[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <C62C3F95-0DD4-4B66-89A8-4FAB819C8A70@intel.com>
Date: Tue, 5 Jun 2018 04:44:16 +0000
From: "Bae, Chang Seok" <chang.seok.bae@...el.com>
To: Mika Penttilä <mika.penttila@...tfour.com>,
"Andy Lutomirski" <luto@...nel.org>,
"H . Peter Anvin" <hpa@...or.com>,
"Thomas Gleixner" <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>
CC: Andi Kleen <ak@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"Metzger, Markus T" <markus.t.metzger@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/6] x86/vdso: Move out the CPU number store
>> diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
>> index ea554f8..e716e94 100644
>> --- a/arch/x86/kernel/setup_percpu.c
>> +++ b/arch/x86/kernel/setup_percpu.c
>> @@ -155,12 +155,21 @@ static void __init pcpup_populate_pte(unsigned long addr)
>>
>> static inline void setup_percpu_segment(int cpu)
>> {
>> -#ifdef CONFIG_X86_32
>> - struct desc_struct d = GDT_ENTRY_INIT(0x8092, per_cpu_offset(cpu),
>> - 0xFFFFF);
>> +#ifdef CONFIG_NUMA
>> + unsigned long node = early_cpu_to_node(cpu);
>> +#else
>> + unsigned long node = 0;
>> +#endif
>> + struct desc_struct d = GDT_ENTRY_INIT(0x0, per_cpu_offset(cpu),
>> + make_lsl_tscp(cpu, node));
>> +
>> + d.type = 5; /* R0 data, expand down, accessed */
>> + d.dpl = 3; /* Visible to user code */
>> + d.s = 1; /* Not a system segment */
>> + d.p = 1; /* Present */
>> + d.d = 1; /* 32-bit */
>>
>> write_gdt_entry(get_cpu_gdt_rw(cpu), GDT_ENTRY_PERCPU, &d, DESCTYPE_S);
>> -#endif
>> }
> This won't work on X86-32 because it actually uses the segment limit with fs: access. So there
> is a reason why the lsl based method is X86-64 only.
The limit will be consumed in X86-64 only, while the unification with i386 was suggested for a
different reason.
Thanks,
Chang
Powered by blists - more mailing lists