Re: [PATCH v8 7/8] KVM: x86/pmu: Emulate RDPMC on performance metrics

From: Andi Kleen

Date: Tue Aug 18 2026 - 15:34:23 EST


On Tue, Aug 18, 2026 at 01:30:32PM -0500, Chen, Zide wrote:
>
>
> On 8/18/2026 12:41 PM, Andi Kleen wrote:
> > On Mon, Aug 17, 2026 at 11:31:41AM -0700, Zide Chen wrote:
> >> If the host has the PERF_METRICS capability but it's not present on
> >> the guest, RDPMC interception must be enabled and KVM should inject
> >> an #GP when the guest attempts a PERF_METRICS RDPMC.
> >>
> >> If the guest has PERF_METRICS but RDPMC interception is enabled for
> >> other reasons, KVM needs to emulate RDPMC with type 0x2000.
> >>
> >> For simplicity, Metrics Clear Mode is not supported.
> >
> > But is the bit cleared in PERF_CAPABILITIES? And would
> > the enable bit fault?
>
> Currently KVM doesn't advertise
> IA32_PERF_CAPABILITIES.RDPMC_METRICS_CLEAR[19].

Thanks.

How about the fault for the enable bit?

> > It would be better to just support it, metrics clear is actually useful.
>
> Sure, I'll add it.

I guess it could be a follow-on patch, no need to hold up this one.

-Andi