From: Ingo Molnar <mingo@kernel.org>
To: Sohil Mehta <sohil.mehta@intel.com>
Cc: x86@kernel.org, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
Uros Bizjak <ubizjak@gmail.com>,
Sandipan Das <sandipan.das@amd.com>,
Sean Christopherson <seanjc@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Vegard Nossum <vegard.nossum@oracle.com>,
Tony Luck <tony.luck@intel.com>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Nikolay Borisov <nik.borisov@suse.com>,
Eric Biggers <ebiggers@google.com>, Xin Li <xin3.li@intel.com>,
Alexander Shishkin <alexander.shishkin@intel.com>,
Kirill Shutemov <kirill.shutemov@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] x86/cpufeature: Add a debug print for unmet dependencies
Date: Sat, 7 Dec 2024 09:35:53 +0100 [thread overview]
Message-ID: <Z1QI6UukVy9uJLrs@gmail.com> (raw)
In-Reply-To: <20241207004126.2054658-2-sohil.mehta@intel.com>
* Sohil Mehta <sohil.mehta@intel.com> wrote:
> Instead of silently disabling features, add a print which might be
> useful to users if their favorite feature gets unexpectedly disabled.
>
> Features are typically represented through unsigned integers though some
> of them have user friendly names if they are exposed via cpuinfo. Show
> the friendlier name if available otherwise display the X86_FEATURE_*
> numerals to make it easier to identify the feature.
>
> Use pr_debug() to avoid spamming the kernel log and generating false
> alarms. Note that the print will occur once per disabled feature on
> every CPU. Show this information only when someone is really looking for
> it.
>
> Suggested-by: Tony Luck <tony.luck@intel.com>
> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
> ---
> Sent as a separate patch to make it easier to review and drop if it
> feels unnecessary.
>
> I can see both sides of the argument. The pr_debug() serves a
> compromise between the two.
>
> v3: New patch.
>
> ---
> arch/x86/kernel/cpu/cpuid-deps.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c
> index 8bea5c5e4fd2..c72f2dd77d72 100644
> --- a/arch/x86/kernel/cpu/cpuid-deps.c
> +++ b/arch/x86/kernel/cpu/cpuid-deps.c
> @@ -147,12 +147,32 @@ void setup_clear_cpu_cap(unsigned int feature)
> do_clear_cpu_cap(NULL, feature);
> }
>
> +/*
> + * 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, 12, "%d*32+%2d", feature / 32, feature % 32);
> +
> + return buf;
> +}
> +
> void filter_feature_dependencies(struct cpuinfo_x86 *c)
> {
> + char feature_buf[12], depends_buf[12];
> const struct cpuid_dep *d;
>
> for (d = cpuid_deps; d->feature; d++) {
> - if (cpu_has(c, d->feature) && !cpu_has(c, d->depends))
> + if (cpu_has(c, d->feature) && !cpu_has(c, d->depends)) {
> + pr_debug("x86/cpu: Disabling feature %s since feature %s is missing\n",
> + x86_feature_name(d->feature, feature_buf),
> + x86_feature_name(d->depends, depends_buf));
> do_clear_cpu_cap(c, d->feature);
So why not make this a pr_info() at minimum?
Since this new logic will disable certain feature bits on random
machines, I'm sure there will be some surprises. I'd sure like to see
this printed in the system log of my machine if it happens.
It might also inform firmware & distro testers that something wasn't
set up properly on the firmware (or virtualization) side.
Thanks,
Ingo
next prev parent reply other threads:[~2024-12-07 8:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-07 0:41 [PATCH v3 1/2] x86/cpufeature: Add feature dependency checks Sohil Mehta
2024-12-07 0:41 ` [PATCH v3 2/2] x86/cpufeature: Add a debug print for unmet dependencies Sohil Mehta
2024-12-07 8:35 ` Ingo Molnar [this message]
2024-12-07 13:14 ` Sohil Mehta
2024-12-07 21:11 ` H. Peter Anvin
2024-12-09 19:28 ` Sohil Mehta
2024-12-09 4:18 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1QI6UukVy9uJLrs@gmail.com \
--to=mingo@kernel.org \
--cc=alexander.shishkin@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=ebiggers@google.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nik.borisov@suse.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=sandipan.das@amd.com \
--cc=seanjc@google.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=ubizjak@gmail.com \
--cc=vegard.nossum@oracle.com \
--cc=x86@kernel.org \
--cc=xin3.li@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox