[PATCH v2 3/4] KVM: arm64: Add KVM_ARM_VCPU_PMU_V3_SET_PMU attribute

Marc Zyngier maz at kernel.org
Wed Dec 8 07:44:35 PST 2021


On Wed, 08 Dec 2021 15:20:30 +0000,
Alexandru Elisei <alexandru.elisei at arm.com> wrote:
> 
> Hi Marc,
> 
> On Wed, Dec 08, 2021 at 02:25:58PM +0000, Marc Zyngier wrote:
> > On Wed, 08 Dec 2021 12:23:44 +0000,
> > Alexandru Elisei <alexandru.elisei at arm.com> wrote:
> > > 
> > > This makes me wonder. Should KVM enforce having userspace either not
> > > setting the PMU for any VCPU, either setting it for all VCPUs? I think this
> > > would be a good idea and will reduce complexity in the long run. I also
> > > don't see a use case for userspace choosing to set the PMU for a subset of
> > > VCPUs, leaving the other VCPUs with the default behaviour.
> > 
> > Indeed. As much as I'm happy to expose a PMU to a guest on an
> > asymmetric system, I really do not want the asymmetry in the guest
> > itself. So this should be an all or nothing behaviour.
> 
> From what I can tell, the only asymmetry that can be exposed to a guest as
> a result of the series is the number of events supported on a VCPU.

Not only. It means that the events are counting different things. It
isn't only about pmuver, which is only about the architectural
revision implemented by the PMU. If you start assigning two different
PMUs (in the perf sense) to a guest, you open the Pandora box of
having to deal with all the subtle nonsense that asymmetric systems
bring. What about event filtering, for example?

> I don't like the idea of forcing userspace to set the *same* PMU for all
> VCPUs, as that would severely limit running VMs with PMU on asymmetric
> systems.

On the contrary, I am *very* happy to limit a VM to a single PMU (and
thus CPU) type on these systems. Really.

> Even if KVM forces to set a PMU (does not have to be the same PMU) for all
> VCPUs, that still does not look like the correct solution for me, because
> userspace can set PMUs with different number of events.

I don't understand what you mean. If you associate a single PMU type
to the guest, that's all the guest sees.

> What I can try is to make kvm->arch.pmuver the minimum version of all the
> VCPU PMUs and the implict PMU. I'll give that a go in the next iteration.

I really don't think we need any of this.

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list