lkml.org 
[lkml]   [2022]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 1/5] perf/x86/intel/lbr: use setup_clear_cpu_cap instead of clear_cpu_cap
Date

> >We have a dependency system for CPUID features. If you are going to do
> this (as opposed to "fixing" this in Qemu or just saying "don't do that,
> it isn't a valid hardware configuration."
> One more thing: for obvious reasons, this doesn't fix user space if user
> space calls CPUID directly as opposed to reading /proc/cpuinfo or looking
> in sysfs. Unfortunately this is the rule rather than the exception,
> although for some features like AVX user space is also supposed to check
> XCR0, in which case it will work properly anyway.

The x86 crypto modules use boot_cpu_has() to check features before
using them.

If that (or some other function that we change them to use) returned false
if the necessary XSAVE bits were not set, then they could drop the
cpu_has_xfeatures() calls.

arch/x86/kernel/fpu/xstate.c, which provides cpu_has_xfeatures(),
and also has an xsave_cpu_features table listing the features needed
be each xfeature. Perhaps that should provide a cpu_feature_usable()
function that calls boot_cpu_has() and confirms the associated xfeatures
are present. That way the logic would be in one place rather than
replicated in 20+ crypto modules.


\
 
 \ /
  Last update: 2022-11-02 20:18    [W:0.225 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site