Re: [PATCH v4] x86/cpufeature: Add feature dependency checks
From: Ingo Molnar
Date: Thu Feb 27 2025 - 13:48:00 EST
* Sohil Mehta <sohil.mehta@xxxxxxxxx> wrote:
> +
> +/*
> + * Return the feature "name" if available otherwise return
> + * the X86_FEATURE_* numerals to make it easier to identify
> + * the feature.
> + */
> +static const char *x86_feature_name(unsigned int feature, char *buf)
> +{
> + if (x86_cap_flags[feature])
> + return x86_cap_flags[feature];
> +
> + snprintf(buf, 16, "%d*32+%2d", feature / 32, feature % 32);
> +
> + return buf;
> +}
> +
> +void filter_feature_dependencies(struct cpuinfo_x86 *c)
> +{
> + char feature_buf[16], depends_buf[16];
> + const struct cpuid_dep *d;
> +
> + for (d = cpuid_deps; d->feature; d++) {
> + if (cpu_has(c, d->feature) && !cpu_has(c, d->depends)) {
> + pr_info("CPU%d: Disabling feature %s due to missing feature %s\n",
> + smp_processor_id(),
> + x86_feature_name(d->feature, feature_buf),
> + x86_feature_name(d->depends, depends_buf));
> + do_clear_cpu_cap(c, d->feature);
> + }
> + }
So let's not disable any CPU features actively for the time being, how
about issuing a pr_warn() only about the dependency violation?
I think the main problem is when these problems slip through 100%
unnoticed.
Thanks,
Ingo