Re: [PATCH v2 13/20] x86/asm/64: Pass sp0 directly to load_sp0()

From: Ingo Molnar
Date: Thu Nov 02 2017 - 05:53:40 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

>
> * Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>
> > load_sp0() had an odd signature:
> >
> > void load_sp0(struct tss_struct *tss, struct thread_struct *thread);
> >
> > Simplify it to:
> >
> > void load_sp0(unsigned long sp0);
>
> I also added this to the changelog:
>
> > Also simplify a few get_cpu()/put_cpu() sequences to
> > preempt_disable()/preempt_enable().
>
> Plus:
>
> > --- a/arch/x86/kernel/cpu/common.c
> > +++ b/arch/x86/kernel/cpu/common.c
> > @@ -1572,7 +1572,7 @@ void cpu_init(void)
> > initialize_tlbstate_and_flush();
> > enter_lazy_tlb(&init_mm, me);
> >
> > - load_sp0(t, &current->thread);
> > + load_sp0(current->thread.sp0);
> > set_tss_desc(cpu, t);
> > load_TR_desc();
> > load_mm_ldt(&init_mm);
> > @@ -1627,7 +1627,7 @@ void cpu_init(void)
> > initialize_tlbstate_and_flush();
> > enter_lazy_tlb(&init_mm, curr);
> >
> > - load_sp0(t, thread);
> > + load_sp0(thread->sp0);
> > set_tss_desc(cpu, t);
> > load_TR_desc();
> > load_mm_ldt(&init_mm);
>
> In the 32-bit path this was the last use of 'thread', making the local variable
> unused - I removed it.

Correction, it's patch #16 that removes the last reference:

[PATCH v2 16/20] x86/boot/64: Stop initializing TSS.sp0 at boot

I removed the local variable there.

Thanks,

Ingo