Re: [PATCH v8 07/26] KVM: x86/pmu: Apply "fast" RDPMC only to Intel PMUs

From: Sean Christopherson
Date: Fri Nov 10 2023 - 12:45:19 EST


On Fri, Nov 10, 2023, Dapeng Mi wrote:
>
> On 11/10/2023 10:12 AM, Sean Christopherson wrote:
> > Move the handling of "fast" RDPMC instructions, which drop bits 63:31 of
>
> 63:32?

Oof, yeah.

> > @@ -55,12 +59,17 @@ static struct kvm_pmc *intel_pmc_idx_to_pmc(struct kvm_pmu *pmu, int pmc_idx)
> > }
> > }
> > +static u32 intel_rdpmc_get_masked_idx(struct kvm_pmu *pmu, u32 idx)
>
> inline?

No, for functions that are visible only to the local compilation unit, there's
no reason to use "inline". "inline" is just a hint, and modern compilers are
smart enough to inline functions when appropriate without a hint, e.g. gcc and
clang inline this on all my configurations. Compilers may also ignore the hint,
e.g. KASAN=y tends to produce some really amusing results.

A longer explanation/rant here: https://lore.kernel.org/all/ZAdfX+S323JVWNZC@xxxxxxxxxx