Re: [PATCH v5 1/2] x86, lib: Add WBNOINVD helper functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 22, 2025 at 4:36 PM Dave Hansen <dave.hansen@xxxxxxxxx> 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!





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux