Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-19 Thread Sebastian Andrzej Siewior
On 2018-09-12 08:49:01 [-0700], Andy Lutomirski wrote: > Sure, but the first write is *before* this. So we can be preempted with the > two copies of PKRU being out of sync. so it took a while to understand this but now that I did, I will consider this in the next version. Thank you. Sebastian

Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Andy Lutomirski
> On Sep 12, 2018, at 8:30 AM, Rik van Riel wrote: > > On Wed, 2018-09-12 at 08:20 -0700, Andy Lutomirski wrote: >>> >>> --- a/arch/x86/mm/pkeys.c >>> +++ b/arch/x86/mm/pkeys.c >>> @@ -18,6 +18,20 @@ >>> >>> #include /* boot_cpu_has, >>> ...*/ >>> #include

Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Paolo Bonzini
On 12/09/2018 17:24, Andy Lutomirski wrote: >> I think you can go a step further and exclude PKRU state from >> copy_kernel_to_fpregs altogether; you just use RDPKRU/WRPKRU. This also >> means you don't need to call __fpregs_* functions in write_pkru. >> >> > Except that the signal ABI has PKRU in

Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Rik van Riel
On Wed, 2018-09-12 at 08:20 -0700, Andy Lutomirski wrote: > > > > --- a/arch/x86/mm/pkeys.c > > +++ b/arch/x86/mm/pkeys.c > > @@ -18,6 +18,20 @@ > > > > #include /* boot_cpu_has, > > ...*/ > > #include /* > > vma_pkey() */ > > +#include > >

Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Andy Lutomirski
> On Sep 12, 2018, at 7:18 AM, Paolo Bonzini wrote: > >> On 12/09/2018 15:33, Sebastian Andrzej Siewior wrote: >> From: Rik van Riel >> >> While most of a task's FPU state is only needed in user space, >> the protection keys need to be in place immediately after a >> context switch. >> >>

Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Andy Lutomirski
> On Sep 12, 2018, at 6:33 AM, Sebastian Andrzej Siewior > wrote: > > From: Rik van Riel > > While most of a task's FPU state is only needed in user space, > the protection keys need to be in place immediately after a > context switch. > > The reason is that any accesses to userspace memor

Re: [RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Paolo Bonzini
On 12/09/2018 15:33, Sebastian Andrzej Siewior wrote: > From: Rik van Riel > > While most of a task's FPU state is only needed in user space, > the protection keys need to be in place immediately after a > context switch. > > The reason is that any accesses to userspace memory while running > in

[RFC PATCH 04/10] x86/fpu: eager switch PKRU state

2018-09-12 Thread Sebastian Andrzej Siewior
From: Rik van Riel While most of a task's FPU state is only needed in user space, the protection keys need to be in place immediately after a context switch. The reason is that any accesses to userspace memory while running in kernel mode also need to abide by the memory permissions specified in