From: Sean Christopherson <seanjc@google.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@intel.com>, X86 ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/cpu: Start documenting what the X86_FEATURE_ flag testing macros do
Date: Fri, 20 Jan 2023 00:35:02 +0000 [thread overview]
Message-ID: <Y8nhtjFcsB63UsmQ@google.com> (raw)
In-Reply-To: <Y8kRuUwsKxYsk1AX@zn.tnic>
On Thu, Jan 19, 2023, Borislav Petkov wrote:
> Another belated reply... ;-\
>
> On Thu, Nov 10, 2022 at 11:27:08PM +0000, Sean Christopherson wrote:
> > What about doing the opposite and folding cpu_feature_enabled()'s build-time
> > functionality into static_cpu_has() _and_ boot_cpu_has(), and then dropping
> > cpu_feature_enabled()? That way the tradeoffs of using the static variant are
> > still captured in code (cpu_feature_enabled() sounds too innocuous to my ears),
> > and as an added bonus even slow paths benefit from build-time disabling of features.
> >
> > Hiding the use of alternatives in cpu_feature_enabled() seems like it will lead to
> > unnecessary code patching.
>
> Actually, tglx and I have a sekrit plan - a small preview below. I don't have
> answers to replacing all functionality we have yet but it is a good start and
> the goal is to eventually get rid of all the gunk that has grown over the years.
> +struct func_1 {
> + /* EDX */
> + union {
> + struct {
> + u32 fpu : 1, vme : 1, de : 1, pse : 1,
> + tsc : 1, msr : 1, pae : 1, mce : 1,
> +
> + cx8 : 1, apic : 1, __rsv2 : 1, sep : 1,
> + mtrr : 1, pge : 1, mca : 1, cmov : 1,
> +
> + pat : 1, pse36 : 1, psn : 1, clfsh : 1,
> + __rsv3 : 1, ds : 1, acpi : 1, mmx : 1,
> +
> + fxsr : 1, sse : 1, sse2 : 1, ss : 1,
> + htt : 1, tm : 1, __rsv4 : 1, pbe : 1;
> + };
> + u32 edx;
> + } __packed;
> +};
IMO, switching to bitfields would be a big step backwards. Visually auditing the
code is difficult, e.g. when reviewing brand new leafs, and using cpufeatures.h as
a quick reference is essentially impossible.
E.g. I often look at cpufeatures.h when I want to know the leaf+bit of a feature,
because trying to find the same info in the SDM or APM is often painful.
prev parent reply other threads:[~2023-01-20 0:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 21:15 [PATCH] x86/cpu: Start documenting what the X86_FEATURE_ flag testing macros do Borislav Petkov
2022-11-07 22:13 ` Dave Hansen
2022-11-08 9:42 ` Borislav Petkov
2022-11-10 23:27 ` Sean Christopherson
2023-01-19 9:47 ` Borislav Petkov
2023-01-20 0:35 ` Sean Christopherson [this message]
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=Y8nhtjFcsB63UsmQ@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.