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

From: Chen, Zide

Date: Tue Aug 18 2026 - 14:30:47 EST




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].
> It would be better to just support it, metrics clear is actually useful.

Sure, I'll add it.
> -Andi