[PATCH v4 0/2] KVM: arm64: Clear VM-wide state when kvm_setup_vcpu() fails

Fuad Tabba fuad.tabba at linux.dev
Sun Nov 1 23:58:41 PST 2026


Hi folks,

Changes since v3 [1]:
  - New patch 2, clearing the default PMU left set by a failed INIT.
  - Reworded patch 1's commit message.
  - Rebased on 7.4-rc1.

A KVM_ARM_VCPU_INIT whose kvm_setup_vcpu() fails doesn't undo its
changes to VM-wide state. Patch 1 clears the feature bitmap, which the
PMU attributes read before the vCPU is initialized. Patch 2 clears the
default PMU, which a retry with KVM_ARM_VCPU_PMU_V3_STRICT would
otherwise inherit.

Tested under QEMU on a host without FEAT_NV1 (an Apple M2 MIDR,
for which has_nv1() returns false), with a reproducer that fails an
INIT and then initializes the PMU, directly for patch 1 and after a
STRICT retry for patch 2.

Based on Linux 7.4-rc1.

Cheers,
/fuad

[1] https://lore.kernel.org/all/20260921190843.107881-1-fuad.tabba@linux.dev/

Fuad Tabba (2):
  KVM: arm64: Clear the VM's feature bitmap when kvm_setup_vcpu() fails
  KVM: arm64: Clear the default PMU when kvm_setup_vcpu() fails

 arch/arm64/kvm/arm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.47.3




More information about the linux-arm-kernel mailing list