Re: [PATCH v2 14/16] KVM: x86/pmu: Ignore AnyThread bit if CPUID.0AH:EDX[15] is set

From: Jim Mattson

Date: Wed Oct 28 2026 - 19:10:04 EST


On Wed, Oct 28, 2026 at 4:05 PM Chen, Zide <zide.chen@xxxxxxxxx> wrote:
>
> On 10/28/2026 4:50 PM, Jim Mattson wrote:
> > On hardware with CPUID.0AH:EDX.ANYTHREAD_DEPRECATION[15] = 1, if software
> > sets the AnyThread bit in IA32_PERFEVTSELx or IA32_FIXED_CTR_CTRL and then
> > reads the MSR back with RDMSR, does hardware return 0 for the AnyThread
> > bit, or does it return 1 but otherwise ignore the bit?
>
> It returns 1. That said, the current implementation, which clears the
> AnyThread bit in intel_pmu_set_msr(), breaks this behavior.
>
> To make matters more subtle, in the case of an invalid configuration
> where ANYTHREAD_DEPRECATION is set in the guest CPUID while deprecation
> is not supported by the host (Ice Lake, for instance), it is better for
> KVM not to pass the AnyThread bits to the host hardware and expect them
> to be ignored by the host.
>
> Is the complete solution to keep the AnyThread bits set in the
> guest-visible states (pmc->eventsel and pmu->fixed_ctr_ctrl) for RDMSR
> readback, but drop them from the hardware-visible states (their _hw
> counterparts)?

That makes sense to me.