[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250214215823.GEZ6-8f5wt--IWggtl@fat_crate.local>
Date: Fri, 14 Feb 2025 22:58:23 +0100
From: Borislav Petkov <bp@...en8.de>
To: "Xin Li (Intel)" <xin@...or.com>
Cc: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
x86@...nel.org, hpa@...or.com, will@...nel.org,
peterz@...radead.org, yury.norov@...il.com,
akpm@...ux-foundation.org, acme@...nel.org, namhyung@...nel.org,
brgerst@...il.com, andrew.cooper3@...rix.com, nik.borisov@...e.com
Subject: Re: [PATCH v5 1/5] x86/cpufeatures: Add {required,disabled} feature
configs
On Sun, Jan 05, 2025 at 11:07:23PM -0800, Xin Li (Intel) wrote:
> From: "H. Peter Anvin (Intel)" <hpa@...or.com>
>
> Required and disabled feature masks completely rely on build configs,
> i.e., once a build config is fixed, so are the feature masks. To prepare
> for auto-generating a header with required and disabled feature masks
> based on a build config, add feature Kconfig items:
> - X86_REQUIRED_FEATURE_x
> - X86_DISABLED_FEATURE_x
> each of which may be set to "y" if and only if its preconditions from
> current build config are met.
>
> X86_CMPXCHG64 and X86_CMOV are required features, thus rename them to
> X86_REQUIRED_FEATURE_CX8 and X86_REQUIRED_FEATURE_CMOV.
>
> Signed-off-by: H. Peter Anvin (Intel) <hpa@...or.com>
> Signed-off-by: Xin Li (Intel) <xin@...or.com>
> ---
>
> Changes since v1:
> * Keep the X86_{REQUIRED,DISABLED}_FEATURE_ prefixes solely in
> arch/x86/Kconfig.cpufeatures (Borislav Petkov).
But that isn't the case yet, right?
There are changes in the code like this now:
#include <asm/nospec-branch.h>
-#ifndef CONFIG_X86_CMPXCHG64
+#ifndef CONFIG_X86_REQUIRED_FEATURE_CX8
extern void cmpxchg8b_emu(void);
which means, I need to know whether I need to use a REQUIRED feature flag or
a normal feature flag, i.e., CONFIG_X86_CMPXCHG64.
Btw, why are you renaming CMPXCHG64 to CX8?
So what would be a lot nicer is if you did this in Kconfig.cpufeatures:
+ config X86_REQUIRED_FEATURE_CMPXCHG64
select X86_CMPXCHG64
+ def_bool y
+ depends on X86_HAVE_PAE || M586TSC || M586MMX || MK6 || MK7
and then use CONFIG_X86_CMPXCHG64 everywhere.
So that the rest of the code doesn't have to know whether those features are
REQUIRED or DISABLED but just features and only the internal machinery does
those additional defines.
Makes sense?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists