diff options
| author | Fuad Tabba <fuad.tabba@linux.dev> | 2026-11-02 07:58:43 +0000 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-11-03 11:58:30 +0000 |
| commit | 4d3361e4d60a46781c8697ee1ab9532f625163f1 (patch) | |
| tree | ab15d5ba8840f1f36227f8e64d1f9bdcded99104 /tools/perf/scripts/python | |
| parent | 2c77a4a3040da8095e052849e2a0a05f598c8601 (diff) | |
KVM: arm64: Clear the default PMU when kvm_setup_vcpu() fails
Under KVM_ARM_VCPU_PMU_V3_STRICT, the VM has no PMU until userspace
selects one, and initializing the PMU fails with -ENXIO until then.
However, without STRICT, kvm_setup_vcpu() selects the default PMU
before it prepares the vCPU for nested virtualization, and leaves it
set when that preparation fails. After a retry with STRICT,
initializing the PMU succeeds and the guest gets the PMU of the CPU
the failed INIT ran on.
Drop the PMU and its number of counters along with the VM's feature
bitmap. While KVM_ARCH_FLAG_VCPU_FEATURES_CONFIGURED is clear, no vCPU
has been initialized and the PMU attributes return -ENODEV, so only
such a failure can have set them. Once the flag is set, every INIT has the
features of the first one that succeeded, which either selected a PMU
or had none to select, so kvm_setup_vcpu() doesn't select another.
Fixes: ad220e275c398 ("KVM: arm64: Add KVM_ARM_VCPU_PMU_V3_STRICT vCPU feature")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://patch.msgid.link/20261102075843.2556018-3-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
