Skip to content

Commit 40e54ca

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: Document default vPMU behavior on heterogeneous systems
KVM maintains a mask of supported CPUs when a vPMU type is explicitly selected by userspace and is used to reject any attempt to run the vCPU on an unsupported CPU. This is great, but we're still beholden to the default behavior where vCPUs can be scheduled anywhere and guest counters may silently stop working. Avoid confusing the next poor sod to look at this code and document the intended behavior. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230525212723.3361524-3-oliver.upton@linux.dev
1 parent 1c913a1 commit 40e54ca

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/arm64/kvm/pmu-emul.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,17 @@ int kvm_arm_pmu_v3_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr)
890890
return -EBUSY;
891891

892892
if (!kvm->arch.arm_pmu) {
893-
/* No PMU set, get the default one */
893+
/*
894+
* No PMU set, get the default one.
895+
*
896+
* The observant among you will notice that the supported_cpus
897+
* mask does not get updated for the default PMU even though it
898+
* is quite possible the selected instance supports only a
899+
* subset of cores in the system. This is intentional, and
900+
* upholds the preexisting behavior on heterogeneous systems
901+
* where vCPUs can be scheduled on any core but the guest
902+
* counters could stop working.
903+
*/
894904
kvm->arch.arm_pmu = kvm_pmu_probe_armpmu();
895905
if (!kvm->arch.arm_pmu)
896906
return -ENODEV;

0 commit comments

Comments
 (0)