mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>,
	Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, pawel.chmielewski@linux.intel.com,
	Farrah Chen <farrah.chen@intel.com>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/3] x86/cpu: Clear feature bits disabled at compile-time
Date: Thu, 12 Feb 2026 13:34:31 -0800	[thread overview]
Message-ID: <E9F385CE-83B8-4088-B6FC-AB113F8DF55C@zytor.com> (raw)
In-Reply-To: <aY35H-VXwoSLFXoj@wieczorr-mobl1.localdomain>

On February 12, 2026 8:23:58 AM PST, Maciej Wieczor-Retman <m.wieczorretman@pm.me> wrote:
>On 2026-02-12 at 16:58:08 +0100, Borislav Petkov wrote:
>>On Thu, Feb 12, 2026 at 03:34:38PM +0000, 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.
>>
>>I'm still unclear as to when did we break this? Did it ever work as
>>documented?
>
>I went as far back as the stable kernels go, to test separate backports and I'm
>pretty sure this behavior was always there. At one point it was just documented
>that is should work in a specific way which right now it doesn't.
>
>>I wanna say yes, I've seen this turning off a feature removes it from
>>/proc/cpuinfo but I don't remember any details...
>
>I believe, previously, the only affected features were the ones that were
>specifically listed with their complementary CONFIG options in the
>disabled-features.h. But most of the older ones are locked behind EXPERT config
>option if one would want to compile-time disable them. When looking at 5.15.x I
>noticed SGX was there when it was not compiled for example. But at 5.10.x there
>were no non-EXPERT features (at least none visible on the machine I was using to
>test).
>
>>> Through the cpufeaturemasks.awk script add a DISABLED_MASK_INITIALIZER
>>> macro that creates an initializer list filled with DISABLED_MASKx
>>> bitmasks.
>>>
>>> At the same time add a REQUIRED_MASK_INITIALIZER that can be used for a
>>> sanity check of whether all the required feature bits are set at the end
>>> of cpu identification.
>>>
>>> Initialize the cpu_caps_cleared array with the autogenerated disabled
>>> bitmask. apply_forced_caps() will clear the corresponding bits in
>>> boot_cpu_data.x86_capability[] and other secondary cpus'
>>> cpu_data.x86_capability[]. Thus features disabled at compile time won't
>>> show up in /proc/cpuinfo.
>>
>>Can you please stop explaining the diff? I can read the diff. Put in the
>>commit message non-obvious text which is important. Not what you're doing.
>>
>>Check all your commit messages pls.
>
>Sure, I'll revise these.
>
>>
>>Thx.
>>
>>--
>>Regards/Gruss,
>>    Boris.
>>
>>https://people.kernel.org/tglx/notes-about-netiquette
>

As the original author of the code I'm pretty sure that bug was always there.

  reply	other threads:[~2026-02-12 21:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 15:33 [PATCH v5 0/3] x86: Capability bits fix and required bits sanity check Maciej Wieczor-Retman
2026-02-12 15:34 ` [PATCH v5 1/3] x86/cpu: Clear feature bits disabled at compile-time Maciej Wieczor-Retman
2026-02-12 15:58   ` Borislav Petkov
2026-02-12 16:23     ` Maciej Wieczor-Retman
2026-02-12 21:34       ` H. Peter Anvin [this message]
2026-02-12 21:51         ` Borislav Petkov
2026-02-12 23:04           ` Sohil Mehta
2026-02-12 23:47             ` Borislav Petkov
2026-02-13  0:14               ` Sohil Mehta
2026-02-13  0:36                 ` Sohil Mehta
2026-02-13  0:58                 ` Borislav Petkov
2026-02-13 20:11                   ` H. Peter Anvin
2026-02-12 15:35 ` [PATCH v5 2/3] x86/cpu: Check if feature string is non-zero Maciej Wieczor-Retman
2026-02-13  0:28   ` Sohil Mehta
2026-02-13 10:02     ` Maciej Wieczor-Retman
2026-02-13 18:22       ` Sohil Mehta
2026-02-13 19:10         ` Maciej Wieczor-Retman
2026-02-13 20:00           ` Sohil Mehta
2026-02-13 20:26             ` Maciej Wieczor-Retman
2026-02-13 20:15       ` H. Peter Anvin
2026-02-13 20:24         ` Maciej Wieczor-Retman
2026-02-12 15:35 ` [PATCH v5 3/3] x86/cpu: Required feature bits sanity check Maciej Wieczor-Retman
2026-02-13 20:17   ` H. Peter Anvin
2026-02-13 20:23 ` [PATCH v5 0/3] x86: Capability bits fix and required " H. Peter Anvin

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=E9F385CE-83B8-4088-B6FC-AB113F8DF55C@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=farrah.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.wieczorretman@pm.me \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mingo@redhat.com \
    --cc=pawel.chmielewski@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®