From: Dave Hansen <dave.hansen@intel.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
Sohil Mehta <sohil.mehta@intel.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: Thu, 7 Nov 2024 17:12:51 -0800 [thread overview]
Message-ID: <4c01a30a-67d9-4918-8781-240b78944c42@intel.com> (raw)
In-Reply-To: <74338393-4F39-4A04-83B1-BA64CE2D2FDA@zytor.com>
On 11/7/24 15:49, H. Peter Anvin wrote:
> Be careful - these bits are used in module strings and so modutils need to understand them.
Yeah, very true. But I didn't ever see these features get used in a
MODULE_DEVICE_TABLE(). Do you still have concerns if there was never an
in-tree user that used X86_FEATURE_P3/P4 in a MODULE_DEVICE_TABLE()?$
Sohil, go look at:
# cat /sys/devices/system/cpu/modalias
cpu:type:x86,ven0000fam0006mod008C:feature:,0000,0001,0002,0003,0004,0005,0006,...
and, for instance:
# modinfo /lib/modules/5.17.0-rc4/kernel/arch/x86/kvm/kvm-intel.ko
filename: /lib/modules/5.17.0-rc4/kernel/arch/x86/kvm/kvm-intel.ko
license: GPL
author: Qumranet
srcversion: ED99EA15FCA9B58172BAEB4
alias: cpu:type:x86,ven*fam*mod*:feature:*0085*
Those magic strings get matched up by udev (I think) to auto-load
modules when the CPU 'modalias' matches the module 'alias'. 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 */
udev might try to load the old module on a new CPU with
X86_FEATURE_WHIZZY_NEW_FEATURE that's not a P3.
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.
next prev parent reply other threads:[~2024-11-08 1:12 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 [this message]
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
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=4c01a30a-67d9-4918-8781-240b78944c42@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--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=sohil.mehta@intel.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®