thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-target-arm-kvm-Retry-KVM_CREATE_VM-call-if-it-fails-.patch

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