Re: [PATCH v2] x86/cpufeature: Add feature dependency checks

From: Sohil Mehta
Date: Wed Oct 30 2024 - 19:57:46 EST


On 10/30/2024 4:44 PM, Luck, Tony wrote:
>> +void filter_feature_dependencies(struct cpuinfo_x86 *c)
>> +{
>> + const struct cpuid_dep *d;
>> +
>> + for (d = cpuid_deps; d->feature; d++) {
>> + if (cpu_has(c, d->feature) && !cpu_has(c, d->depends))
>> + do_clear_cpu_cap(c, d->feature);
>> + }
>> +}
>
> The dependency check found something very wrong. Should there be
> a pr_warn() to give some clue that Linux papered over this problem?
>

Not sure if this necessitates a warning. A missing feature may not be a
problem for the user. I am treating a disabled feature due to the
original CPUID enumeration not being present vs due to a dependency not
being met as the same.

System and kernel developers would definitely care if an expected
feature is missing. Maybe a pr_debug()? Want to avoid unnecessary
escalations and bug reports.

Sohil