yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch

26ba25
From 657543de9cde26be992ca594b0717136709a4ae6 Mon Sep 17 00:00:00 2001
26ba25
From: Laurent Vivier <lvivier@redhat.com>
26ba25
Date: Wed, 23 Jan 2019 08:45:16 +0000
26ba25
Subject: [PATCH 11/11] cpus: ignore ESRCH in qemu_cpu_kick_thread()
26ba25
26ba25
RH-Author: Laurent Vivier <lvivier@redhat.com>
26ba25
Message-id: <20190123084516.16337-1-lvivier@redhat.com>
26ba25
Patchwork-id: 84091
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH] cpus: ignore ESRCH in qemu_cpu_kick_thread()
26ba25
Bugzilla: 1665844
26ba25
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
26ba25
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
26ba25
26ba25
We can have a race condition between qemu_cpu_kick_thread() and
26ba25
qemu_kvm_cpu_thread_fn() when we hotunplug a CPU. In this case,
26ba25
qemu_cpu_kick_thread() can try to kick a thread that is exiting.
26ba25
pthread_kill() returns an error and qemu is stopped by an exit(1).
26ba25
26ba25
   qemu:qemu_cpu_kick_thread: No such process
26ba25
26ba25
We can ignore safely this error.
26ba25
26ba25
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
26ba25
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
26ba25
(cherry picked from commit e9979ef245549b8e1fd240ec9937271c7fda0b57)
26ba25
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
26ba25
26ba25
BRANCH: rhel8/master-2.12.0
26ba25
BZ:   https://bugzilla.redhat.com/show_bug.cgi?id=1665844
26ba25
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19905508
26ba25
UPSTREAM: In maintainer pull request
26ba25
          git://github.com/bonzini/qemu.git tags/for-upstream
26ba25
          3cf01054d896fa88ea0dd31c5abb605c2e68bb29
26ba25
TEST: Upstream version tested by QE
26ba25
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 cpus.c | 2 +-
26ba25
 1 file changed, 1 insertion(+), 1 deletion(-)
26ba25
26ba25
diff --git a/cpus.c b/cpus.c
26ba25
index 398392b..6100089 100644
26ba25
--- a/cpus.c
26ba25
+++ b/cpus.c
26ba25
@@ -1700,7 +1700,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
26ba25
     }
26ba25
     cpu->thread_kicked = true;
26ba25
     err = pthread_kill(cpu->thread->thread, SIG_IPI);
26ba25
-    if (err) {
26ba25
+    if (err && err != ESRCH) {
26ba25
         fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
26ba25
         exit(1);
26ba25
     }
26ba25
-- 
26ba25
1.8.3.1
26ba25