Re: [PATCH v8 1/3] x86/cpu: Clear feature bits disabled at compile-time

From: Maciej Wieczor-Retman

Date: Tue Mar 10 2026 - 06:55:27 EST


On 2026-03-09 at 16:47:49 -0700, Sohil Mehta wrote:
>On 3/2/2026 7:25 AM, Maciej Wieczor-Retman wrote:
>
>> /* Aligned to unsigned long to avoid split lock in atomic bitmap ops */
>> -__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long));
>> +__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long)) =
>> + DISABLED_MASK_INITIALIZER;
>
>IIUC, DISABLED_MASK_INITIALIZER only contains the X86_FEATURE_* bits.
>So, the NBUGINTS bits in cpu_caps_cleared[] are implicitly set to 0.
>
>Should that be mentioned in the comment above? It wasn't obvious to me
>when I first looked at it.

As I understand the features can be compile time disabled while bugs can't? So
it wouldn't be practical to initialize the BUGS part of cpu_caps_cleared. But I
suppose it doesn't hurt to clarify it in the patch message.

--
Kind regards
Maciej Wieczór-Retman