thebeanogamer / rpms / qemu-kvm

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