thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
97168e
From 3014c7c11b6e64433fe9f3c463bd91e318ac96b6 Mon Sep 17 00:00:00 2001
97168e
From: Jon Maloy <jmaloy@redhat.com>
97168e
Date: Wed, 9 Nov 2022 18:41:18 -0500
97168e
Subject: [PATCH 2/2] target/arm/kvm: Retry KVM_CREATE_VM call if it fails
97168e
 EINTR
97168e
97168e
RH-Author: Jon Maloy <jmaloy@redhat.com>
97168e
RH-MergeRequest: 228: qemu-kvm: backport some aarch64 fixes
97168e
RH-Bugzilla: 2132609
97168e
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
97168e
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
97168e
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
97168e
RH-Acked-by: Gavin Shan <gshan@redhat.com>
97168e
RH-Commit: [2/2] 8494bbfb3fcd8693f56312f984d2964d1ca275c2 (jmaloy/qemu-kvm)
97168e
97168e
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2132609
97168e
Upstream: Merged
97168e
97168e
commit bbde13cd14ad4eec18529ce0bf5876058464e124
97168e
Author: Peter Maydell <peter.maydell@linaro.org>
97168e
Date:   Fri Sep 30 12:38:24 2022 +0100
97168e
97168e
    target/arm/kvm: Retry KVM_CREATE_VM call if it fails EINTR
97168e
97168e
    Occasionally the KVM_CREATE_VM ioctl can return EINTR, even though
97168e
    there is no pending signal to be taken. In commit 94ccff13382055
97168e
    we added a retry-on-EINTR loop to the KVM_CREATE_VM call in the
97168e
    generic KVM code. Adopt the same approach for the use of the
97168e
    ioctl in the Arm-specific KVM code (where we use it to create a
97168e
    scratch VM for probing for various things).
97168e
97168e
    For more information, see the mailing list thread:
97168e
    https://lore.kernel.org/qemu-devel/8735e0s1zw.wl-maz@kernel.org/
97168e
97168e
    Reported-by: Vitaly Chikunov <vt@altlinux.org>
97168e
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
97168e
    Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
97168e
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
97168e
    Acked-by: Marc Zyngier <maz@kernel.org>
97168e
    Message-id: 20220930113824.1933293-1-peter.maydell@linaro.org
97168e
97168e
(cherry picked from commit bbde13cd14ad4eec18529ce0bf5876058464e124)
97168e
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
97168e
---
97168e
 target/arm/kvm.c | 4 +++-
97168e
 1 file changed, 3 insertions(+), 1 deletion(-)
97168e
97168e
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
97168e
index bbf1ce7ba3..1ae4e51055 100644
97168e
--- a/target/arm/kvm.c
97168e
+++ b/target/arm/kvm.c
97168e
@@ -80,7 +80,9 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,
97168e
     if (max_vm_pa_size < 0) {
97168e
         max_vm_pa_size = 0;
97168e
     }
97168e
-    vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size);
97168e
+    do {
97168e
+        vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size);
97168e
+    } while (vmfd == -1 && errno == EINTR);
97168e
     if (vmfd < 0) {
97168e
         goto err;
97168e
     }
97168e
-- 
97168e
2.37.3
97168e