Re: [PATCH 0/8] x86/msr: Consolidate native/paravirt MSR functions

From: Dave Hansen

Date: Tue Mar 31 2026 - 17:49:42 EST


On 3/20/26 16:33, Borislav Petkov wrote:
> I *think* this is only a naming issue and with "raw_" you probably wanna say
> "native_or_paravirt_" depending on the ifdeffery... but shorter...
>
> If so, I wouldn't call it "raw". I'd say
>
> xx_read_msr()
> xx_write_msr()

How about we just stick with the paravirt naming?

We're completely used to having stubs that do nothing for paravirt.
We're also used to paravirt_foo() ending up *eventually* doing
native_foo(). So, why not just short-circuit that at the compiler and do:

/* Short-circuit the paravirt infrastructure when it is disabled: */
#define paravirt_read_msr native_read_msr
#define paravirt_read_msr_safe native_read_msr_safe
#define paravirt_write_msr native_write_msr
#define paravirt_write_msr_safe native_write_msr_safe

I'll hack something together and see if I hate it.