[PATCH RFC] KVM: arm64: PMU: Use multiple host PMUs
Oliver Upton
oliver.upton at linux.dev
Thu Mar 20 10:44:03 PDT 2025
On Thu, Mar 20, 2025 at 09:19:02AM +0000, Marc Zyngier wrote:
> On Wed, 19 Mar 2025 18:51:28 +0000, Oliver Upton <oliver.upton at linux.dev> wrote:
> > I'm at least willing to plug my nose and do the following:
> >
> > 1) When the VMM does not specify a vPMU type:
> >
> > - We continue to present the 'default' PMU (including event counters)
> > to the VM
> >
> > - KVM ensures that the fixed CPU cycle counter works on any PMUv3
> > implementation in the system, even if it is different from the
> > default
> >
> > - Otherwise, event counters will only count on the default
> > implementation and will not count on different PMUs
>
> I think this is confusing. The CC is counting, but nothing else, and
> people using the cycle counters in conjunction with other events (a
> very common use case) will not be able to correlate things correctly.
> The current behaviour is, for all its sins, at least consistent.
You of course have a good point. What Windows is doing is definitely an
outlier.
> >
> > 2) Implement your suggestion of a UAPI where the VMM can select a PMU
> > that only has the CPU cycle counter and works on any PMUv3
> > implementation.
> >
> > Either way KVM will need to have some special case handling of the fixed
> > CPU cycle counter. That'd allow users to actually run Windows *now* and
> > provide a clear mechanism for userspace to present a less-broken vPMU if
> > it cares.
>
> Honestly, I don't care about one guest or another. My point is that if
> we are changing the behaviour of the PMU to deal with this sort of
> things, then it has to be a userspace buy-in.
I'm fine with just the user buy-in then. But I still do care about the
guest compatibility issue, especially since the end user of all this
crap is unlikely to know/care about the fine details of the
implementation.
So, Akihiko, I would *greatly* appreciate it if you propose a complete
solution to the problem, including the KVM and VMM patches to make it
all work.
Thanks,
Oliver
More information about the linux-arm-kernel
mailing list