Commit 4639b72f61a3 ("arm64: Add --vcpu-affinity command line argument") introduced the --vcpu-affinity command line argument to pin the VCPUs to a given list of physical CPUs. Unfortunately, the affinity is set only for an arm64 guest, leading to the following error when running a 32-bit guest on a system with two or more PMUs: KVM exit reason: 9 ("KVM_EXIT_FAIL_ENTRY") Registers: PC: 0x8000c608 PSTATE: 0x200000d3 SP_EL1: 0x0 LR: 0x0 *pc: 0x8000c608: 25 3f a0 e1 83 61 a0 e1 0x8000c610: 83 31 98 e7 04 10 82 e1 0x8000c618: 07 2c 81 e3 28 10 1b e5 0x8000c620: 03 20 82 e3 03 00 a0 e1 *lr: Warning: unable to translate guest address 0x0 to host 0x00000000: <unknown> 0x00000008: <unknown> 0x00000010: <unknown> 0x00000018: <unknown> # KVM compatibility warning. virtio-net device was not detected. While you have requested a virtio-net device, the guest kernel did not initialize it. Please make sure that the guest kernel was compiled with CONFIG_VIRTIO_NET=y enabled in .config. # KVM session ended normally. Make the error go away by setting the affinity of the VCPUs for both 32-bit and 64-bit guests. Fixes: 4639b72f61a3 ("arm64: Add --vcpu-affinity command line argument") Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx> --- arm/aarch64/kvm-cpu.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arm/aarch64/kvm-cpu.c b/arm/aarch64/kvm-cpu.c index 4ac0fafae06b..c8be10b3ca94 100644 --- a/arm/aarch64/kvm-cpu.c +++ b/arm/aarch64/kvm-cpu.c @@ -88,16 +88,7 @@ static void reset_vcpu_aarch64(struct kvm_cpu *vcpu) { struct kvm *kvm = vcpu->kvm; struct kvm_one_reg reg; - cpu_set_t *affinity; u64 data; - int ret; - - affinity = kvm->arch.vcpu_affinity_cpuset; - if (affinity) { - ret = sched_setaffinity(0, sizeof(cpu_set_t), affinity); - if (ret == -1) - die_perror("sched_setaffinity"); - } reg.addr = (u64)&data; @@ -179,7 +170,18 @@ int kvm_cpu__configure_features(struct kvm_cpu *vcpu) void kvm_cpu__reset_vcpu(struct kvm_cpu *vcpu) { - if (vcpu->kvm->cfg.arch.aarch32_guest) + struct kvm *kvm = vcpu->kvm; + cpu_set_t *affinity; + int ret; + + affinity = kvm->arch.vcpu_affinity_cpuset; + if (affinity) { + ret = sched_setaffinity(0, sizeof(cpu_set_t), affinity); + if (ret == -1) + die_perror("sched_setaffinity"); + } + + if (kvm->cfg.arch.aarch32_guest) return reset_vcpu_aarch32(vcpu); else return reset_vcpu_aarch64(vcpu); -- 2.36.1 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm