Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-19 Thread Ira Weiny
On Mon, Oct 19, 2020 at 11:37:14AM +0200, Peter Zijlstra wrote: > On Fri, Oct 16, 2020 at 10:14:10PM -0700, Ira Weiny wrote: > > > so it either needs to > > > explicitly do so, or have an assertion that preemption is indeed > > > disabled. > > > > However, I don't think I understand clearly. Does

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-19 Thread Peter Zijlstra
On Fri, Oct 16, 2020 at 10:14:10PM -0700, Ira Weiny wrote: > > so it either needs to > > explicitly do so, or have an assertion that preemption is indeed > > disabled. > > However, I don't think I understand clearly. Doesn't [get|put]_cpu_ptr() > handle the preempt_disable() for us? It does. >

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-16 Thread Ira Weiny
On Fri, Oct 16, 2020 at 01:06:36PM +0200, Peter Zijlstra wrote: > On Fri, Oct 09, 2020 at 12:42:53PM -0700, ira.we...@intel.com wrote: > > > @@ -644,6 +663,8 @@ void __switch_to_xtra(struct task_struct *prev_p, > > struct task_struct *next_p) > > > > if ((tifp ^ tifn) & _TIF_SLD) > >

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-16 Thread Ira Weiny
On Fri, Oct 16, 2020 at 01:12:26PM +0200, Peter Zijlstra wrote: > On Tue, Oct 13, 2020 at 11:31:45AM -0700, Dave Hansen wrote: > > > +/** > > > + * It should also be noted that the underlying WRMSR(MSR_IA32_PKRS) is > > > not > > > + * serializing but still maintains ordering properties similar to

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-16 Thread Peter Zijlstra
On Tue, Oct 13, 2020 at 11:31:45AM -0700, Dave Hansen wrote: > > +/** > > + * It should also be noted that the underlying WRMSR(MSR_IA32_PKRS) is not > > + * serializing but still maintains ordering properties similar to WRPKRU. > > + * The current SDM section on PKRS needs updating but should be t

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-16 Thread Peter Zijlstra
On Fri, Oct 09, 2020 at 12:42:53PM -0700, ira.we...@intel.com wrote: > @@ -644,6 +663,8 @@ void __switch_to_xtra(struct task_struct *prev_p, struct > task_struct *next_p) > > if ((tifp ^ tifn) & _TIF_SLD) > switch_to_sld(tifn); > + > + pks_sched_in(); > } > You seem

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-14 Thread Ira Weiny
On Tue, Oct 13, 2020 at 11:31:45AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > The PKRS MSR is defined as a per-logical-processor register. This > > isolates memory access by logical CPU. Unfortunately, the MSR is not > > managed by XS

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-13 Thread Dave Hansen
On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > From: Ira Weiny > > The PKRS MSR is defined as a per-logical-processor register. This > isolates memory access by logical CPU. Unfortunately, the MSR is not > managed by XSAVE. Therefore, tasks must save/restore the MSR value on > context switc

[PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-09 Thread ira . weiny
From: Ira Weiny The PKRS MSR is defined as a per-logical-processor register. This isolates memory access by logical CPU. Unfortunately, the MSR is not managed by XSAVE. Therefore, tasks must save/restore the MSR value on context switch. Define a saved PKRS value in the task struct, as well as