From: Sohil Mehta <sohil.mehta@intel.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>, <tglx@kernel.org>,
<bp@alien8.de>, <mingo@redhat.com>, <darwi@linutronix.de>,
<thuth@redhat.com>, <dave.hansen@linux.intel.com>,
<ak@linux.intel.com>, <babu.moger@amd.com>,
<chang.seok.bae@intel.com>, <peterz@infradead.org>,
<nik.borisov@suse.com>, <jpoimboe@kernel.org>,
<pawan.kumar.gupta@linux.intel.com>, <hpa@zytor.com>,
<xin@zytor.com>, <maciej.wieczor-retman@intel.com>
Cc: <x86@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v10 3/3] x86/cpu: Do a sanity check on required feature bits
Date: Tue, 17 Mar 2026 13:43:54 -0700 [thread overview]
Message-ID: <b6c91d10-b31e-4974-835a-e815f6f109e2@intel.com> (raw)
In-Reply-To: <8180d2f5c3da2737167418d3a28b008a933c6408.1773771353.git.m.wieczorretman@pm.me>
On 3/17/2026 1:00 PM, Maciej Wieczor-Retman wrote:
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
>
> After CPU identification concludes, do a sanity check by comparing the
> final x86_capability bitmask with the pre-defined required feature bits.
>
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
> Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> ---
A minor concern below. Other than that,
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
>
> +/*
> + * As a sanity check compare the final x86_capability bitmask with the initial
> + * predefined required feature bits.
> + */
> +static void verify_required_features(const struct cpuinfo_x86 *c)
> +{
> + u32 missing[NCAPINTS] = REQUIRED_MASK_INIT;
> + char cap_buf[X86_CAP_BUF_SIZE];
> + unsigned int i;
> + u32 error = 0;
> +
> + for (i = 0; i < NCAPINTS; i++) {
> + missing[i] &= ~c->x86_capability[i];
> + error |= missing[i];
> + }
> +
> + if (!error)
> + return;
> +
> + /* At least one required feature is missing */
> + pr_warn("CPU %d: missing required feature(s):", c->cpu_index);
> + for_each_set_bit(i, (unsigned long *)missing, NCAPINTS * 32)
> + pr_cont(" %s", x86_cap_name(i, cap_buf));
> + pr_cont("\n");
Could multiple APs run into this concurrently? I am wondering if there
is some risk of garbled output because of the pr_warn()/pr_cont()
combination.
Though, I don't have an easy fix if it is an issue.
> + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
> +}
> +
> /*
> * This does the hard work of actually picking apart the CPU stuff...
> */
> @@ -2134,6 +2161,8 @@ static void identify_cpu(struct cpuinfo_x86 *c)
> mcheck_cpu_init(c);
>
> numa_add_cpu(smp_processor_id());
> +
> + verify_required_features(c);
> }
>
> /*
next prev parent reply other threads:[~2026-03-17 20:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 20:00 [PATCH v10 0/3] x86: Capability bits fix and required bits sanity check Maciej Wieczor-Retman
2026-03-17 20:00 ` [PATCH v10 1/3] x86/cpu: Clear feature bits disabled at compile-time Maciej Wieczor-Retman
2026-03-17 20:00 ` [PATCH v10 2/3] x86/cpu: Check if feature string is non-zero Maciej Wieczor-Retman
2026-03-17 20:29 ` Sohil Mehta
2026-03-18 23:41 ` Pawan Gupta
2026-03-19 17:18 ` Maciej Wieczor-Retman
2026-03-17 20:00 ` [PATCH v10 3/3] x86/cpu: Do a sanity check on required feature bits Maciej Wieczor-Retman
2026-03-17 20:43 ` Sohil Mehta [this message]
2026-03-18 10:08 ` Maciej Wieczor-Retman
2026-03-19 0:02 ` Pawan Gupta
2026-03-19 17:46 ` Maciej Wieczor-Retman
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=b6c91d10-b31e-4974-835a-e815f6f109e2@intel.com \
--to=sohil.mehta@intel.com \
--cc=ak@linux.intel.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=chang.seok.bae@intel.com \
--cc=darwi@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.wieczorretman@pm.me \
--cc=maciej.wieczor-retman@intel.com \
--cc=mingo@redhat.com \
--cc=nik.borisov@suse.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--cc=thuth@redhat.com \
--cc=x86@kernel.org \
--cc=xin@zytor.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
all inboxes | Powered by JetHome®