RE: [PATCH 03/35] x86/entry/32: Load task stack from x86_tss.sp1 in SYSENTER handler

From: David Laight
Date: Thu Apr 19 2018 - 05:01:05 EST


From: Andi Kleen
> Sent: 19 April 2018 01:39
>
> On Wed, Apr 18, 2018 at 05:02:02PM -0700, Linus Torvalds wrote:
> > On Wed, Apr 18, 2018 at 4:26 PM, Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:
> > >
> > > Seems like a hack. Why can't that be stored in a per cpu variable?
> >
> > It *is* a percpu variable - the whole x86_tss structure is percpu.
> >
> > I guess it could be a different (separate) percpu variable, but might
> > as well use the space we already have allocated.
>
> Would be better/cleaner to use a separate variable instead of reusing
> x86 structures like this. Who knows what subtle side effects that
> may have eventually.
>
> It will be also easier to understand in the code.

You could (probably) use an unnamed union in the x86_tss structure
so that it is more obvious that the two variables share a location.

David