Re: [PATCH v11 4/4] x86/cpu: Clear feature bits whose dependencies were cleared

From: Maciej Wieczor-Retman

Date: Wed Mar 25 2026 - 05:37:25 EST


On 2026-03-23 at 20:30:33 +0100, Borislav Petkov wrote:
>On Mon, Mar 23, 2026 at 11:57:45AM -0700, H. Peter Anvin wrote:
>> I do have to say that using awk for these things, especially being restricted
>> to POSIX awk, is really awful as it really is pushing the limits of that tool.
>> String processing in C is most definitely no fun either -- the single biggest
>> shortcoming of what is otherwise one of my favorite languages -- but it
>> *would* also be possible to refactor cpuid-deps.c so that it can be compiled
>> in user space and linked with a C tool that would replace cpufeaturesmask.awk,
>> mkcapflags.sh, and boot/mkcpustr.c.
>>
>> This seemed to me to be a bit excessive in terms of churn and complexity, but
>> perhaps this is what you are looking for?
>
>I was actually suggesting we handle the dependent features in
>apply_forced_caps() and keep that all in one place.
>
>As to the whole glue handling deps, feature flags, names, yadda yadda, yap,
>I agree, it ain't easy and I need to grep each time where the generated files
>are and go stare at them.
>
>So I really like the idea of replacing it all with a C tool which you can
>massage in luserspace and replace all that other gunk and we won't depend on
>the awk flavor or shell script or whatnot but keep everything in a single
>C program and a header.
>
>I don't know whether that would work and how ugly it would become - we need to
>try it I guess - but the idea ure sounds enticing...
>
>Maybe something for a future todo.
>
>:-)
>
>--
>Regards/Gruss,
> Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette

I'll move the cpuid_deps[] checking to apply_forced_caps() for now then.

I can try giving the C tool a shot too, we were previously thinking that merging
x86_cap_flags[] and x86_bug_flags[] could be a nice cleanup. But using the
current scripts that turned out to not have any real benefits, maybe that's
worth looking into as well when rewriting the scripts into C?

--
Kind regards
Maciej Wieczór-Retman