Re: [PATCH v2 11/16] KVM: x86/pmu: Emulate the GLOBAL_STATUS_SET and GLOBAL_INUSE MSRs
From: Jim Mattson
Date: Fri Oct 30 2026 - 08:02:41 EST
On Thu, Oct 29, 2026 at 10:45 AM Chen, Zide <zide.chen@xxxxxxxxx> wrote:
> On 10/28/2026 4:24 PM, Jim Mattson wrote:
[ ... ]
> > As I pointed out in patch 04/16, we can't pass through the PMU global
> > controls unless their reserved bits match hardware.
>
> Totally agree. Then the handling of bit 55 breaks this rule as well.
>
> if (vmx_pt_mode_is_host_guest())
> pmu->global_status_rsvd &= ~GLOBAL_STATUS_TRACE_TOPAPMI;
>
> Always intercepting GLOBAL_OVF_CTRL and GLOBAL_STATUS_SET can solve this
> problem, but it may impair guest performance, especially for nested.
>
> Instead, I'd propal to have separate reserved masks:
> - pmu->global_status_rsvd: unchanged, strictly tracking virtualized
> guest state and preserving live migration validation.
> - pmu->global_status_{clr,set}_rsvd: unmasking all architecturally valid
> hardware bits for the corresponding MSRs on v4+.
>
> Any bits allowed by hardware but unvirtualized by KVM are
> scrubbed/filtered in intel_mediated_pmu_{put,load}().
That is a terrible proposal. MSR bits that vanish at unpredictable
times?!? No. If an MSR contains bits that aren't virtualized, that MSR
can't be passed through. Full stop.