[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1c35c9c-e657-4074-b87e-98fb4b332bc5@intel.com>
Date: Wed, 22 Jan 2025 16:36:31 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Kevin Loughlin <kevinloughlin@...gle.com>, linux-kernel@...r.kernel.org
Cc: 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 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.
Powered by blists - more mailing lists