[PATCH v5 0/3] x86: Capability bits fix and required bits sanity check
From: Maciej Wieczor-Retman
Date: Thu Feb 12 2026 - 10:35:25 EST
Series aims to fix the inconsistency between the cpuinfo behavior and
the documentation. Specifically the features that are not compiled are
still present in the cpuinfo bitmasks as enabled. This is not in line
with the documentation which specifies that not-compiled features are
not present in /proc/cpuinfo.
Along adding the disabled feature bitmask initializer array, the
complementary required bitmask initializer is also added. It can be used
to provide a sanity check, after the cpu identification is finished, to
make sure every required bit is set in the final bitmask. A warning with
the cpu number and all required bits that were not set is emitted in
case of the sanity check failure.
Before adding the sanity check a small cleanup can be done. Three places
open code an operation that retrieves either a feature string or, if the
string is not present, the feature number in word:bit format. One of
these places also doesn't check whether the string is actually there or
not. The cleanup patch fixes that and simplifies the other two
instances.
Previous patchset versions:
v4: https://lore.kernel.org/all/20250724125346.2792543-1-maciej.wieczor-retman@xxxxxxxxx/
v3: https://lore.kernel.org/all/20250724094554.2153919-1-maciej.wieczor-retman@xxxxxxxxx/
v2: https://lore.kernel.org/all/20250723092250.3411923-1-maciej.wieczor-retman@xxxxxxxxx/
v1: https://lore.kernel.org/all/20250722074439.4069992-1-maciej.wieczor-retman@xxxxxxxxx/
Maciej Wieczor-Retman (3):
x86/cpu: Clear feature bits disabled at compile-time
x86/cpu: Check if feature string is non-zero
x86/cpu: Required feature bits sanity check
arch/x86/kernel/cpu/common.c | 60 +++++++++++++++++++++++++++---
arch/x86/kernel/cpu/cpuid-deps.c | 21 ++---------
arch/x86/tools/cpufeaturemasks.awk | 6 +++
include/linux/cpu.h | 2 +
4 files changed, 65 insertions(+), 24 deletions(-)
--
2.53.0