lkml.org 
[lkml]   [2021]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch V3 41/66] x86/cpu: Sanitize X86_FEATURE_OSPKE
On Fri, Jun 18, 2021 at 04:19:04PM +0200, Thomas Gleixner wrote:
> X86_FEATURE_OSPKE is enabled first on the boot CPU and the feature flag is
> set. Secondary CPUs have to enable CR4.PKE as well and set their per CPU
> feature flag. That's ineffective because all call sites have checks for
> boot_cpu_data.
>
> Make it smarter and force the feature flag when PKU is enabled on the boot
> cpu which allows then to use cpu_feature_enabled(X86_FEATURE_OSPKE) all
> over the place. That either compiles the code out when PKEY support is
> disabled in Kconfig or uses a static_cpu_has() for the feature check which
> makes a significant difference in hotpathes, e.g. context switch.

"hotpaths"

>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> arch/x86/include/asm/pkeys.h | 8 ++++----
> arch/x86/include/asm/pkru.h | 4 ++--
> arch/x86/kernel/cpu/common.c | 24 +++++++++++-------------
> arch/x86/kernel/fpu/core.c | 2 +-
> arch/x86/kernel/fpu/xstate.c | 2 +-
> arch/x86/kernel/process_64.c | 2 +-
> arch/x86/mm/fault.c | 2 +-
> 7 files changed, 21 insertions(+), 23 deletions(-)

Other than that:

Reviewed-by: Borislav Petkov <bp@suse.de>

--
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

\
 
 \ /
  Last update: 2021-06-22 16:17    [W:0.408 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site