The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sohil Mehta <sohil.mehta@intel.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: Farrah Chen <farrah.chen@intel.com>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 1/3] x86/cpu: Clear feature bits disabled at compile-time
Date: Tue, 10 Mar 2026 15:00:30 -0700	[thread overview]
Message-ID: <5701aca3-5ca7-4cf3-a2d9-18bc570b150c@intel.com> (raw)
In-Reply-To: <c5b1b08d77fab1ca7f11c1464324703f212d144c.1773165421.git.m.wieczorretman@pm.me>

On 3/10/2026 11:03 AM, Maciej Wieczor-Retman wrote:
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
> 
> If some config options are disabled during compile time, they still are
> enumerated in macros that use the x86_capability bitmask - cpu_has() or
> this_cpu_has().
> 
> The features are also visible in /proc/cpuinfo even though they are not
> enabled - which is contrary to what the documentation states about the
> file. Examples of such feature flags are lam, fred, sgx, ibrs_enhanced,
> split_lock_detect, user_shstk, avx_vnni and enqcmd.
> 

Do all of these features have compile time options today? For example, I
couldn't find X86_DISABLED_FEATURE_* equivalent for ibrs_enhanced,
split_lock_detect or avx_vnni. Maybe I am missing some obvious connection.

But, if these can't be disabled using config options, it would be better
to avoid any mention of them here.

> Once the cpu_caps_cleared[] is initialized with the autogenerated
> disabled bitmask apply_forced_caps() will clear the corresponding bits
> in boot_cpu_data.x86_capability[] and other secondary CPUs'

This sentence was a bit hard to read for me. How about?

Initialize cpu_caps_cleared[] with an autogenerated disabled bitmask.
During CPU init, apply_forced_caps() will clear the corresponding bits
in struct cpuinfo_x86 for each CPU. Thus features disabled at...

> cpu_data.x86_capability[]. Thus features disabled at compile time won't
> show up in /proc/cpuinfo.
> 
> No BUGS are defined to be cleared at compile time, therefore only the
> NCAPINTS part of cpu_caps_cleared[] is initialized. The NBUGINTS part is

..NCAPINTS part of cpu_caps_cleared[] is initialized using the macro.
The NBUGINTS part is set to zero.

> set initialized to zero.
> 

You don't need the word 'initialized' here.


> Reported-by: Farrah Chen <farrah.chen@intel.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220348
> Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
> ---

>  arch/x86/kernel/cpu/common.c       | 3 ++-
>  arch/x86/tools/cpufeaturemasks.awk | 6 ++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 

The code changes look good to me,

Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>




  reply	other threads:[~2026-03-10 22:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 18:01 [PATCH v9 0/3] x86: Capability bits fix and required bits sanity check Maciej Wieczor-Retman
2026-03-10 18:03 ` [PATCH v9 1/3] x86/cpu: Clear feature bits disabled at compile-time Maciej Wieczor-Retman
2026-03-10 22:00   ` Sohil Mehta [this message]
2026-03-11 13:16     ` Maciej Wieczor-Retman
2026-03-10 18:03 ` [PATCH v9 2/3] x86/cpu: Check if feature string is non-zero Maciej Wieczor-Retman
2026-03-10 22:35   ` Sohil Mehta
2026-03-11 13:48     ` Maciej Wieczor-Retman
2026-03-10 18:03 ` [PATCH v9 3/3] x86/cpu: Do a sanity check on required feature bits Maciej Wieczor-Retman
2026-03-10 23:13   ` Sohil Mehta
2026-03-11 14:33     ` Maciej Wieczor-Retman
2026-03-11 15: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=5701aca3-5ca7-4cf3-a2d9-18bc570b150c@intel.com \
    --to=sohil.mehta@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=farrah.chen@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.wieczorretman@pm.me \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /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