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

Re: [PATCH v2 11/12] x86/paravirt: Don't use pv_ops vector for MSR access functions



On Tue, Sep 30, 2025 at 09:03:55AM +0200, Juergen Gross wrote:

> +static __always_inline u64 read_msr(u32 msr)
> +{
> +     if (cpu_feature_enabled(X86_FEATURE_XENPV))
> +             return xen_read_msr(msr);
> +
> +     return native_rdmsrq(msr);
> +}
> +
> +static __always_inline int read_msr_safe(u32 msr, u64 *p)
> +{
> +     if (cpu_feature_enabled(X86_FEATURE_XENPV))
> +             return xen_read_msr_safe(msr, p);
> +
> +     return native_read_msr_safe(msr, p);
> +}
> +
> +static __always_inline void write_msr(u32 msr, u64 val)
> +{
> +     if (cpu_feature_enabled(X86_FEATURE_XENPV))
> +             xen_write_msr(msr, val);
> +     else
> +             native_wrmsrq(msr, val);
> +}
> +
> +static __always_inline int write_msr_safe(u32 msr, u64 val)
> +{
> +     if (cpu_feature_enabled(X86_FEATURE_XENPV))
> +             return xen_write_msr_safe(msr, val);
> +
> +     return native_write_msr_safe(msr, val);
> +}
> +
> +static __always_inline u64 rdpmc(int counter)
> +{
> +     if (cpu_feature_enabled(X86_FEATURE_XENPV))
> +             return xen_read_pmc(counter);
> +
> +     return native_read_pmc(counter);
> +}

Egads, didn't we just construct giant ALTERNATIVE()s for the native_
things? Why wrap that in a cpu_feature_enabled() instead of just adding
one more case to the ALTERNATIVE() ?



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.