On Fri, Nov 24, 2017 at 06:23:48PM +0100, Ingo Molnar wrote: > From: Andy Lutomirski <l...@kernel.org> > > The existing code was a mess, mainly because C arrays are nasty. > Turn SYSENTER_stack into a struct, add a helper to find it, and do > all the obvious cleanups this enables. > > Signed-off-by: Andy Lutomirski <l...@kernel.org> > Signed-off-by: Thomas Gleixner <t...@linutronix.de> > Cc: Borislav Petkov <bpet...@suse.de> > Cc: Brian Gerst <brge...@gmail.com> > Cc: Dave Hansen <dave.han...@intel.com> > Cc: Josh Poimboeuf <jpoim...@redhat.com> > Cc: Linus Torvalds <torva...@linux-foundation.org> > Cc: Peter Zijlstra <pet...@infradead.org> > Link: > https://lkml.kernel.org/r/38ff640712c9b591b32de24a080daf13afaba234.1511497875.git.l...@kernel.org > Signed-off-by: Ingo Molnar <mi...@kernel.org> > ---
... > diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c > index 61b1af88ac07..46c0995344aa 100644 > --- a/arch/x86/kernel/asm-offsets.c > +++ b/arch/x86/kernel/asm-offsets.c > @@ -94,10 +94,8 @@ void common(void) { > BLANK(); > DEFINE(PTREGS_SIZE, sizeof(struct pt_regs)); > > - /* Offset from cpu_tss to SYSENTER_stack */ > - OFFSET(CPU_TSS_SYSENTER_stack, tss_struct, SYSENTER_stack); > - /* Size of SYSENTER_stack */ > - DEFINE(SIZEOF_SYSENTER_stack, sizeof(((struct tss_struct > *)0)->SYSENTER_stack)); > + OFFSET(TSS_STRUCT_SYSENTER_stack, tss_struct, SYSENTER_stack); > + DEFINE(SIZEOF_SYSENTER_stack, sizeof(struct SYSENTER_stack)); > > /* Layout info for cpu_entry_area */ > OFFSET(CPU_ENTRY_AREA_tss, cpu_entry_area, tss); > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 6b949e6ea0f9..f9c7e6852874 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -1332,12 +1332,7 @@ void enable_sep_cpu(void) > > tss->x86_tss.ss1 = __KERNEL_CS; > wrmsr(MSR_IA32_SYSENTER_CS, tss->x86_tss.ss1, 0); > - > - wrmsr(MSR_IA32_SYSENTER_ESP, > - (unsigned long)&get_cpu_entry_area(cpu)->tss + > - offsetofend(struct tss_struct, SYSENTER_stack), > - 0); > - > + wrmsr(MSR_IA32_SYSENTER_ESP, (unsigned long)(cpu_SYSENTER_stack(cpu) + > 1), 0); > wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0); Right, so we have now two TSS thingies, AFAICT: tss = &per_cpu(cpu_tss, cpu); which is cpu_tss and then indirectly, we have also: &get_cpu_entry_area((cpu))->tss And those are two different things in my guest here: [ 0.044002] tss: 0xf5747000 [ 0.044706] entry area tss: 0xffef1000 What is the logic here? We carry two TSSs per CPU - one which is RO for the entry area and the other is the actual cpu_tss thing? Or am I misreading it? Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.