[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6eecf873-9d87-5345-70ba-5c064a31714b@linux.intel.com>
Date: Fri, 15 Jun 2018 11:48:34 -0700
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: Andy Lutomirski <luto@...nel.org>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Rik van Riel <riel@...riel.com>
Cc: LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>
Subject: Re: Lazy FPU restoration / moving kernel_fpu_end() to context switch
On 06/15/2018 11:31 AM, Andy Lutomirski wrote:
> for (thing) {
> kernel_fpu_begin();
> encrypt(thing);
> kernel_fpu_end();
> }
Don't forget that the processor has optimizations for this, too. The
"modified optimization" will notice that between:
kernel_fpu_end(); -> XRSTOR
and
kernel_fpu_start(); -> XSAVE(S|OPT)
the processor has not modified the states. It'll skip doing any writes
of the state. Doing what Andy is describing is still way better than
letting the processor do it, but you should just know up front that this
may not be as much of a win as you would expect.
Powered by blists - more mailing lists