[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180919171945.rd7dni7mih4yrh7r@linutronix.de>
Date: Wed, 19 Sep 2018 19:19:45 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Rik van Riel <riel@...riel.com>, linux-kernel@...r.kernel.org,
x86@...nel.org, Andy Lutomirski <luto@...nel.org>,
Radim Krčmář <rkrcmar@...hat.com>,
kvm@...r.kernel.org, "Jason A. Donenfeld" <Jason@...c4.com>
Subject: Re: [RFC PATCH 04/10 v2 ] x86/fpu: eager switch PKRU state
On 2018-09-19 19:00:34 [+0200], Paolo Bonzini wrote:
> On 19/09/2018 18:57, Sebastian Andrzej Siewior wrote:
> > On 2018-09-19 07:55:51 [+0200], Paolo Bonzini wrote:
> >> A kthread can do use_mm/unuse_mm.
> >
> > indeed. The FPU struct for the kernel thread isn't valid / does not
> > contain the expected PKRU value. So loading the pkru value from the
> > struct FPU does not work as expected. We could set it to 0 for a kernel
> > thread so we don't end up with a random value.
> > If we want to get this usecase working then we would have to move pkru
> > value from FPU to mm_struct and consider it in use_mm(). Do we want
> > this?
>
> As a start, I think keeping it in the FPU struct but loading it
> unconditionally will work. kthreads will not obey PKU but it will be
> better already.
Are you saying I should load the uninitialized value for kthreads or
load 0 to have in a known state?
> I honestly don't know if PKRU should be per-mm, I don't know mm very
> well despite my brilliant observation above. :)
Now that I have qemu machine with PKRU I would need to figure out how
this works. So unless I am mistaken mm is per task and the FPU is per
thread. And since the FPU struct isn't initialized for kthreads, we
should end up with 0. But setting to 0 if not used sounds good.
> Paolo
Sebastian
Powered by blists - more mailing lists