[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f98160b0-4f8b-41ab-b555-8e9de83c8552@intel.com>
Date: Wed, 22 Jan 2025 15:16:38 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Tom Lendacky <thomas.lendacky@....com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Kevin Loughlin <kevinloughlin@...gle.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, kai.huang@...el.com,
ubizjak@...il.com, jgross@...e.com, kvm@...r.kernel.org, pgonda@...gle.com,
sidtelang@...gle.com, mizhang@...gle.com, rientjes@...gle.com,
manalinandan@...gle.com, szy0127@...u.edu.cn
Subject: Re: [PATCH v4 1/2] x86, lib: Add WBNOINVD helper functions
On 1/22/25 11:39, Tom Lendacky wrote:
>> I think you need to do something like.
>>
>> alternative("wbinvd", ".byte 0xf3; wbinvd", X86_FEATURE_WBNOINVD);
> I think "rep; wbinvd" would work as well.
I don't want to bike shed this too much.
But, please, no.
The fact that wbnoinvd can be expressed as "rep; wbinvd" is a
implementation detail. Exposing how it's encoded in the ISA is only
going to add confusion. This:
static __always_inline void wbnoinvd(void)
{
asm volatile(".byte 0xf3,0x0f,0x09\n\t": : :"memory");
}
is perfectly fine and a billion times less confusing than:
asm volatile(".byte 0xf3; wbinvd\n\t": : :"memory");
or
asm volatile("rep; wbinvd\n\t": : :"memory");
It only gets worse if it's mixed in an alternative() with the _actual_
wbinvd.
BTW, I don't think you should be compelled to use alternative() as
opposed to a good old:
if (cpu_feature_enabled(X86_FEATURE_WBNOINVD))
...
Powered by blists - more mailing lists