Re: [PATCH v6 5/8] KVM: x86/pmu: Support PERF_METRICS MSR in mediated vPMU

From: Jim Mattson

Date: Thu Jul 23 2026 - 23:16:23 EST


On Thu, Jul 23, 2026 at 4:44 PM Chen, Zide <zide.chen@xxxxxxxxx> wrote:
> The SDM guidance that "fixed counter 3 must be restored before
> PERF_METRICS" appears to apply only to a running PMU, which is not the
> case here.

That's not my reading of the SDM. There are three bullet points about
save/restore at the end of volume 3, section 22.3.9.3:

* PERF_METRICS and fixed-function performance-monitoring counter 3
should be saved and restored together.
* To ensure that PERF_METRICS and fixed-function
performance-monitoring counter 3 remain synchronized,
both should be disabled during both save and restore. Software should
enable/disable them atomically, with a
single write to IA32_PERF_GLOBAL_CTRL to set/clear both
EN_PERF_METRICS[bit 48] and
EN_FIXED_CTR3[bit 35].
* On state restore, fixed-function performance-monitoring counter 3
must be restored before PERF_METRICS,
otherwise undefined results may be observed.

The second bullet contradicts your claim above.