]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/arm/kvm: Retry KVM_CREATE_VM call if it fails EINTR
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 30 Sep 2022 11:38:24 +0000 (12:38 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 10 Oct 2022 13:52:23 +0000 (14:52 +0100)
Occasionally the KVM_CREATE_VM ioctl can return EINTR, even though
there is no pending signal to be taken. In commit 94ccff13382055
we added a retry-on-EINTR loop to the KVM_CREATE_VM call in the
generic KVM code. Adopt the same approach for the use of the
ioctl in the Arm-specific KVM code (where we use it to create a
scratch VM for probing for various things).

For more information, see the mailing list thread:
https://lore.kernel.org/qemu-devel/8735e0s1zw.wl-maz@kernel.org/

Reported-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Message-id: 20220930113824.1933293-1-peter.maydell@linaro.org

target/arm/kvm.c

index e5c1bd50d29baf1795ae38b93ac13eac53965f46..1e4de9b42e3dc1ebc5bf323d53156e0e3089d783 100644 (file)
@@ -79,7 +79,9 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,
     if (max_vm_pa_size < 0) {
         max_vm_pa_size = 0;
     }
-    vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size);
+    do {
+        vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size);
+    } while (vmfd == -1 && errno == EINTR);
     if (vmfd < 0) {
         goto err;
     }