Re: [PATCH v12 2/4] x86/cpu: Check if feature string is non-zero

From: Maciej Wieczor-Retman

Date: Fri Mar 27 2026 - 17:30:14 EST


On 2026-03-27 at 10:50:29 -0700, Sohil Mehta wrote:
>On 3/27/2026 8:10 AM, Maciej Wieczor-Retman wrote:
>
>> arch/x86/kernel/cpu/common.c | 30 +++++++++++++++++++++++++-----
>> arch/x86/kernel/cpu/cpu.h | 4 ++++
>> arch/x86/kernel/cpu/cpuid-deps.c | 19 +++----------------
>> 3 files changed, 32 insertions(+), 21 deletions(-)
>>
>
>Reviewed-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
>
>A couple of minor points below:
>
>
>> @@ -1637,6 +1638,7 @@ static inline bool parse_set_clear_cpuid(char *arg, bool set)
>>
>> while (arg) {
>> bool found __maybe_unused = false;
>> + char name_buf[X86_NAMELESS_FEAT_BUFLEN];
>> unsigned int bit;
>>
>> opt = strsep(&arg, ",");
>> @@ -1657,10 +1659,7 @@ static inline bool parse_set_clear_cpuid(char *arg, bool set)
>> setup_clear_cpu_cap(bit);
>> }
>> /* empty-string, i.e., ""-defined feature flags */
>
>Can you delete this comment as well. It doesn't make sense now.

Right, will do, thanks!

>
>> - if (!x86_cap_flags[bit])
>> - pr_cont(" %d:%d\n", bit >> 5, bit & 31);
>> - else
>> - pr_cont(" %s\n", x86_cap_flags[bit]);
>> + pr_cont(" %s\n", x86_feature_name(bit, name_buf));
>
>All the other equivalent buffers are defined as feature_buf, but this
>one is named as name_buf. Just curious, any specific reason?

I think I was experimenting with cleaning up a further part of
parse_set_clear_cpuid() that printed a string from either x86_bug_flags or
x86_cap_flags. It looked ugly so I scrapped it but I guess I forgot to change
the name_buf to feature_buf. I'll correct that, thanks for noticing it :)

>>
>> taint++;
>> }

--
Kind regards
Maciej Wieczór-Retman