Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-26 Thread Ingo Molnar
* Thomas Gleixner wrote: > On Sun, 25 Nov 2018, Andy Lutomirski wrote: > > > On Nov 25, 2018, at 2:20 PM, Thomas Gleixner wrote: > > > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > > > >>> The current check whether two tasks belong to the same context is using > > >>> the > > >>> tasks

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-26 Thread Ingo Molnar
* Thomas Gleixner wrote: > On Sun, 25 Nov 2018, Andy Lutomirski wrote: > > > On Nov 25, 2018, at 2:20 PM, Thomas Gleixner wrote: > > > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > > > >>> The current check whether two tasks belong to the same context is using > > >>> the > > >>> tasks

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Andy Lutomirski wrote: > > On Nov 25, 2018, at 2:20 PM, Thomas Gleixner wrote: > > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > >>> The current check whether two tasks belong to the same context is using > >>> the > >>> tasks context id. While correct, it's simpler to use

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Andy Lutomirski wrote: > > On Nov 25, 2018, at 2:20 PM, Thomas Gleixner wrote: > > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > >>> The current check whether two tasks belong to the same context is using > >>> the > >>> tasks context id. While correct, it's simpler to use

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Andi Kleen wrote: > On Sun, Nov 25, 2018 at 11:20:50PM +0100, Thomas Gleixner wrote: > > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > > > > The current check whether two tasks belong to the same context is using > > > > the > > > > tasks context id. While correct, it's

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Andi Kleen wrote: > On Sun, Nov 25, 2018 at 11:20:50PM +0100, Thomas Gleixner wrote: > > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > > > > The current check whether two tasks belong to the same context is using > > > > the > > > > tasks context id. While correct, it's

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Andi Kleen
On Sun, Nov 25, 2018 at 11:20:50PM +0100, Thomas Gleixner wrote: > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > > The current check whether two tasks belong to the same context is using > > > the > > > tasks context id. While correct, it's simpler to use the mm pointer > > > because > > > it

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Andi Kleen
On Sun, Nov 25, 2018 at 11:20:50PM +0100, Thomas Gleixner wrote: > On Sun, 25 Nov 2018, Andi Kleen wrote: > > > > The current check whether two tasks belong to the same context is using > > > the > > > tasks context id. While correct, it's simpler to use the mm pointer > > > because > > > it

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Andy Lutomirski
> On Nov 25, 2018, at 2:20 PM, Thomas Gleixner wrote: > > On Sun, 25 Nov 2018, Andi Kleen wrote: > >>> The current check whether two tasks belong to the same context is using the >>> tasks context id. While correct, it's simpler to use the mm pointer because >>> it allows to mangle the

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Andy Lutomirski
> On Nov 25, 2018, at 2:20 PM, Thomas Gleixner wrote: > > On Sun, 25 Nov 2018, Andi Kleen wrote: > >>> The current check whether two tasks belong to the same context is using the >>> tasks context id. While correct, it's simpler to use the mm pointer because >>> it allows to mangle the

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Andi Kleen wrote: > > The current check whether two tasks belong to the same context is using the > > tasks context id. While correct, it's simpler to use the mm pointer because > > it allows to mangle the TIF_SPEC_IB bit into it. The context id based > > mechanism requires

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Andi Kleen wrote: > > The current check whether two tasks belong to the same context is using the > > tasks context id. While correct, it's simpler to use the mm pointer because > > it allows to mangle the TIF_SPEC_IB bit into it. The context id based > > mechanism requires

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Andi Kleen
> The current check whether two tasks belong to the same context is using the > tasks context id. While correct, it's simpler to use the mm pointer because > it allows to mangle the TIF_SPEC_IB bit into it. The context id based > mechanism requires extra storage, which creates worse code. [We

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Andi Kleen
> The current check whether two tasks belong to the same context is using the > tasks context id. While correct, it's simpler to use the mm pointer because > it allows to mangle the TIF_SPEC_IB bit into it. The context id based > mechanism requires extra storage, which creates worse code. [We

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Thomas Gleixner wrote: > /* > + * Use bit 0 to mangle the TIF_SPEC_IB state into the mm pointer which is > + * stored in cpu_tlb_state.last_user_mm_ibpb. > + */ > +#define LAST_USER_MM_IBPB0x1UL > + > +/* > + unsigned long next_tif = task_thread_info(next)->flags; > +

Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm()

2018-11-25 Thread Thomas Gleixner
On Sun, 25 Nov 2018, Thomas Gleixner wrote: > /* > + * Use bit 0 to mangle the TIF_SPEC_IB state into the mm pointer which is > + * stored in cpu_tlb_state.last_user_mm_ibpb. > + */ > +#define LAST_USER_MM_IBPB0x1UL > + > +/* > + unsigned long next_tif = task_thread_info(next)->flags; > +