[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGdbjmJtBaBt9p3-Kk=XdZZW9LAgz4nuWSDOUdPQ2jY=MpFa2w@mail.gmail.com>
Date: Wed, 22 Jan 2025 16:55:35 -0800
From: Kevin Loughlin <kevinloughlin@...gle.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
seanjc@...gle.com, pbonzini@...hat.com, kirill.shutemov@...ux.intel.com,
kai.huang@...el.com, ubizjak@...il.com, jgross@...e.com, kvm@...r.kernel.org,
thomas.lendacky@....com, pgonda@...gle.com, sidtelang@...gle.com,
mizhang@...gle.com, rientjes@...gle.com, manalinandan@...gle.com,
szy0127@...u.edu.cn
Subject: Re: [PATCH v5 1/2] x86, lib: Add WBNOINVD helper functions
On Wed, Jan 22, 2025 at 4:36 PM Dave Hansen <dave.hansen@...el.com> wrote:
>
> On 1/22/25 16:24, Kevin Loughlin wrote:
> > +static __always_inline void wbnoinvd(void)
> > +{
> > + /*
> > + * WBNOINVD is encoded as 0xf3 0x0f 0x09. Making this
> > + * encoding explicit ensures compatibility with older versions of
> > + * binutils, which may not know about WBNOINVD.
>
> This kinda pokes at one of my pet peeves. It's writing a comment where
> code would do. I'd *much* rather write a function that explains to you
> in code that "WBNOINVD is encoded as 0xf3 0x0f 0x09":
>
> static __always_inline void native_wbnoinvd(void)
> {
> asm volatile(".byte 0xf3,0x0f,0x09\n\t": : :"memory");
> }
>
> instead of writing out a comment. It's kinda silly to have to write out
> the encoding explicitly in a comment and then have to rewrite it in the
> code.
Yeah, I see your point. I will add this native_wbnoinvd() wrapper in v6; thanks!
Powered by blists - more mailing lists