[PATCH] KVM: arm64: selftests: Pin vpmu_counter_access to one CPU
James Clark
james.clark at linaro.org
Wed Nov 25 07:36:03 PST 2026
The vpmu_counter_access test reads the maximum PMCR_EL0.N from one VM
and then creates new VMs for each number of counters up to that limit.
If the test migrates between CPU types the limit may not be valid for
the new VM which causes:
==== Test Assertion Failure ====
arm64/vpmu_counter_access.c:483: !ret
pid=9165 tid=9165 errno=22 - Invalid argument
...
KVM_SET_DEVICE_ATTR failed, rc: -1 errno: 22 (Invalid argument)
For example on a Radxa Orion O6 with 20 counters on the big cores and 6
on the little cores, this happens on most runs.
Fix it by pinning the test to the CPU that it starts on before any VMs
are created.
Signed-off-by: James Clark <james.clark at linaro.org>
---
Assisted by Claude Opus 5.5.
---
tools/testing/selftests/kvm/arm64/vpmu_counter_access.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c b/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c
index 22223395969e..e7eac736260e 100644
--- a/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c
+++ b/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c
@@ -626,6 +626,9 @@ int main(void)
{
u64 i, pmcr_n;
+ /* get_pmcr_n_limit() can be different across CPUs, so pin */
+ pin_self_to_any_cpu();
+
TEST_REQUIRE(kvm_has_cap(KVM_CAP_ARM_PMU_V3));
TEST_REQUIRE(kvm_supports_vgic_v3());
TEST_REQUIRE(kvm_supports_nr_counters_attr());
---
base-commit: 5715eba4f80a7655d85581c6c951b71d2abbd725
change-id: 20261125-james-kvm-pin-pmu-test-720393980044
Best regards,
--
James Clark <james.clark at linaro.org>
More information about the linux-arm-kernel
mailing list