From: Maciej Wieczor-Retman <m.wieczorretman@pm.me>
To: Borislav Petkov <bp@alien8.de>
Cc: dave.hansen@linux.intel.com, hpa@zytor.com, xin@zytor.com,
chang.seok.bae@intel.com, mingo@redhat.com,
elena.reshetova@intel.com, maciej.wieczor-retman@intel.com,
babu.moger@amd.com, sohil.mehta@intel.com,
pawan.kumar.gupta@linux.intel.com, pmladek@suse.com,
nik.borisov@suse.com, ptesarik@suse.com, darwi@linutronix.de,
tglx@kernel.org, peterz@infradead.org, jpoimboe@kernel.org,
ak@linux.intel.com, linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v12 2/4] x86/cpu: Check if feature string is non-zero
Date: Mon, 30 Mar 2026 20:42:11 +0000 [thread overview]
Message-ID: <acrcfqjucaikTWoM@wieczorr-mobl1.localdomain> (raw)
In-Reply-To: <20260330200045.GUacrWbcsBhp9a-kfb@fat_crate.local>
On 2026-03-30 at 22:00:45 +0200, Borislav Petkov wrote:
>On Fri, Mar 27, 2026 at 03:10:52PM +0000, Maciej Wieczor-Retman wrote:
>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
>> index 76339e988304..7cfd124b3fbf 100644
>> --- a/arch/x86/kernel/cpu/common.c
>> +++ b/arch/x86/kernel/cpu/common.c
>> @@ -678,6 +678,7 @@ cpuid_dependent_features[] = {
>> static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
>> {
>> const struct cpuid_dependent_feature *df;
>> + char feature_buf[X86_NAMELESS_FEAT_BUFLEN];
>
>The tip-tree preferred ordering of variable declarations at the
>beginning of a function is reverse fir tree order::
>
> struct long_struct_name *descriptive_name;
> unsigned long foo, bar;
> unsigned int tmp;
> int ret;
>
>The above is faster to parse than the reverse ordering::
>
> int ret;
> unsigned int tmp;
> unsigned long foo, bar;
> struct long_struct_name *descriptive_name;
>
>And even more so than random ordering::
>
> unsigned long foo, bar;
> int ret;
> struct long_struct_name *descriptive_name;
> unsigned int tmp;
>
>Check your whole set pls.
Sorry, will do.
>
>...
>
>> +/*
>> + * Return the feature "name" if available, otherwise return the
>> + * X86_FEATURE_* numerals to make it easier to identify the feature.
>
>"return the X86_FEATURE word number and bit position...."
>
>Might as well correct it to be more precise.
so maybe:
+ * Return the feature's "name" if available, otherwise return the
+ * feature's bit numerals in "word:bit" format so it's easier to identify.
?
>> + * Callers of this function need to pass a char * buffer of size
>> + * X86_NAMELESS_FEAT_BUFLEN.
>> + */
>> +const char *x86_feature_name(unsigned int bit, char *buf)
>
>...
>
>> void check_cpufeature_deps(struct cpuinfo_x86 *c)
>> {
>> - char feature_buf[16], depends_buf[16];
>> + char feature_buf[X86_NAMELESS_FEAT_BUFLEN], depends_buf[X86_NAMELESS_FEAT_BUFLEN];
>
>Blergh, that define is too long. ;-\
X86_NAMELESS_FEAT_BUF?
X86_NUM_FEAT_BUF?
Not sure how to make it much more shorter without making it also unreadable.
--
Kind regards
Maciej Wieczór-Retman
next prev parent reply other threads:[~2026-03-30 20:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 15:10 [PATCH v12 0/4] x86: Capability bits fix and required bits sanity check Maciej Wieczor-Retman
2026-03-27 15:10 ` [PATCH v12 1/4] x86/cpu: Clear feature bits disabled at compile-time Maciej Wieczor-Retman
2026-03-27 15:10 ` [PATCH v12 2/4] x86/cpu: Check if feature string is non-zero Maciej Wieczor-Retman
2026-03-27 17:50 ` Sohil Mehta
2026-03-27 21:28 ` Maciej Wieczor-Retman
2026-03-30 20:00 ` Borislav Petkov
2026-03-30 20:42 ` Maciej Wieczor-Retman [this message]
2026-03-30 21:15 ` Borislav Petkov
2026-03-30 21:44 ` H. Peter Anvin
2026-03-30 22:59 ` Borislav Petkov
2026-03-30 23:42 ` H. Peter Anvin
2026-03-31 2:15 ` H. Peter Anvin
2026-03-31 13:27 ` Borislav Petkov
2026-03-27 15:10 ` [PATCH v12 3/4] x86/cpu: Do a sanity check on required feature bits Maciej Wieczor-Retman
2026-03-27 17:10 ` Pawan Gupta
2026-03-27 17:22 ` Maciej Wieczor-Retman
2026-03-27 15:11 ` [PATCH v12 4/4] x86/cpu: Clear feature bits whose dependencies were cleared Maciej Wieczor-Retman
2026-03-28 2:22 ` H. Peter Anvin
2026-03-30 10:40 ` Maciej Wieczor-Retman
2026-03-30 21:41 ` Ahmed S. Darwish
2026-03-31 11:41 ` Maciej Wieczor-Retman
2026-04-01 15:16 ` Maciej Wieczor-Retman
2026-04-13 14:42 ` Ahmed S. Darwish
2026-03-30 6:11 ` [PATCH v12 0/4] x86: Capability bits fix and required bits sanity check Andi Kleen
2026-03-30 8:52 ` Maciej Wieczor-Retman
2026-03-30 23:40 ` H. Peter Anvin
2026-03-31 14:02 ` Borislav Petkov
2026-03-31 14:27 ` Maciej Wieczor-Retman
2026-03-31 14:46 ` Borislav Petkov
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=acrcfqjucaikTWoM@wieczorr-mobl1.localdomain \
--to=m.wieczorretman@pm.me \
--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=elena.reshetova@intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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=pmladek@suse.com \
--cc=ptesarik@suse.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@kernel.org \
--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