From: Sohil Mehta <sohil.mehta@intel.com>
To: Dave Hansen <dave.hansen@intel.com>,
"H. Peter Anvin" <hpa@zytor.com>, <x86@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
"Sean Christopherson" <seanjc@google.com>,
Tony Luck <tony.luck@intel.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/cpufeatures: Free up unused feature bits
Date: Fri, 8 Nov 2024 10:42:55 -0800 [thread overview]
Message-ID: <ee05e1a2-3844-4648-b9d5-7534de94d85e@intel.com> (raw)
In-Reply-To: <4c01a30a-67d9-4918-8781-240b78944c42@intel.com>
On 11/7/2024 5:12 PM, Dave Hansen wrote:
> Let's say
> we had an ooooooooold module that did this:
>
> #ifdef MODULE
> static const struct x86_cpu_id foo_cpu_id[] = {
> X86_MATCH_FEATURE(X86_FEATURE_P3, NULL),
> {}
> };
> MODULE_DEVICE_TABLE(x86cpu, foo_cpu_id);
> #endif
>
> which generated a modalias like this:
>
> alias: cpu:type:x86,ven*fam*mod*:feature:*0067*
>
> and then we recycled number 67:
>
> -#define X86_FEATURE_P3 ( 3*32+ 6) /* P3 */
> +#define X86_FEATURE_WHIZZY_NEW_FEATURE ( 3*32+ 6) /* P3 */
>
Coretemp (hwmon) seems to follow this pattern exactly.
commit 9b38096fde5f ("HWMON: Convert coretemp to x86 cpuid autoprobing")
adds X86_FEATURE_DTS to MODULE_DEVICE_TABLE(x86cpu, coretemp_ids)
commit 2ccd71f1b278 ("x86/cpufeature: Move some of the scattered feature
bits to x86_capability") frees up X86_FEATURE_DTS(DTHERM).
-#define X86_FEATURE_DTHERM ( 7*32+ 7) /* Digital Thermal Sensor */
commit 765a0542fdc7 ("x86/virt/tdx: Detect TDX during kernel boot")
reuses that bit.
+#define X86_FEATURE_TDX_HOST_PLATFORM ( 7*32+ 7) /* Platform supports
being a TDX host */
> udev might try to load the old module on a new CPU with
> X86_FEATURE_WHIZZY_NEW_FEATURE that's not a P3.
>
So an old coretemp module could get loaded when the above TDX bit is
set. Not sure how likely this scenario is or what can we do to avoid it now?
> I sure hope we haven't been using too many of these synthetic features
> in MODULE_DEVICE_TABLE()s, because we tend to move them around, but I
> guess it's possible.
At least features X86_FEATURE_P3 and X86_FEATURE_P4 seem safe to be
recycled as they haven't been used in MODULE_DEVICE_TABLE().
next prev parent reply other threads:[~2024-11-08 18:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 23:30 Sohil Mehta
2024-11-07 23:36 ` Dave Hansen
2024-11-07 23:44 ` Sohil Mehta
2024-11-07 23:49 ` H. Peter Anvin
2024-11-08 0:35 ` Sohil Mehta
2024-11-08 0:37 ` H. Peter Anvin
2024-11-08 1:12 ` Dave Hansen
2024-11-08 2:17 ` Sohil Mehta
2024-11-08 15:31 ` H. Peter Anvin
2024-11-08 18:42 ` Dave Hansen
2024-11-08 18:42 ` Sohil Mehta [this message]
2024-11-08 18:46 ` Dave Hansen
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=ee05e1a2-3844-4648-b9d5-7534de94d85e@intel.com \
--to=sohil.mehta@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--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®