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

7711c0
From 9e6a36459015ac8ac3c8e550bd2242c127203370 Mon Sep 17 00:00:00 2001
7711c0
From: Laurent Vivier <lvivier@redhat.com>
7711c0
Date: Wed, 23 Jan 2019 08:48:57 +0100
7711c0
Subject: [PATCH 4/8] cpus: ignore ESRCH in qemu_cpu_kick_thread()
7711c0
7711c0
RH-Author: Laurent Vivier <lvivier@redhat.com>
7711c0
Message-id: <20190123084857.16841-1-lvivier@redhat.com>
7711c0
Patchwork-id: 84094
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH] cpus: ignore ESRCH in qemu_cpu_kick_thread()
7711c0
Bugzilla: 1614610
7711c0
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
7711c0
RH-Acked-by: Serhii Popovych <spopovyc@redhat.com>
7711c0
RH-Acked-by: Thomas Huth <thuth@redhat.com>
7711c0
7711c0
We can have a race condition between qemu_cpu_kick_thread() and
7711c0
qemu_kvm_cpu_thread_fn() when we hotunplug a CPU. In this case,
7711c0
qemu_cpu_kick_thread() can try to kick a thread that is exiting.
7711c0
pthread_kill() returns an error and qemu is stopped by an exit(1).
7711c0
7711c0
   qemu:qemu_cpu_kick_thread: No such process
7711c0
7711c0
We can ignore safely this error.
7711c0
7711c0
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
7711c0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7711c0
(cherry picked from commit e9979ef245549b8e1fd240ec9937271c7fda0b57)
7711c0
7711c0
BZ:   https://bugzilla.redhat.com/show_bug.cgi?id=1614610
7711c0
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19894361
7711c0
UPSTREAM: In maintainer pull request
7711c0
          git://github.com/bonzini/qemu.git tags/for-upstream
7711c0
          3cf01054d896fa88ea0dd31c5abb605c2e68bb29
7711c0
TEST: Upstream version tested by QE
7711c0
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 cpus.c | 2 +-
7711c0
 1 file changed, 1 insertion(+), 1 deletion(-)
7711c0
7711c0
diff --git a/cpus.c b/cpus.c
7711c0
index be3a4eb..f9798e3 100644
7711c0
--- a/cpus.c
7711c0
+++ b/cpus.c
7711c0
@@ -1700,7 +1700,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
7711c0
     }
7711c0
     cpu->thread_kicked = true;
7711c0
     err = pthread_kill(cpu->thread->thread, SIG_IPI);
7711c0
-    if (err) {
7711c0
+    if (err && err != ESRCH) {
7711c0
         fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
7711c0
         exit(1);
7711c0
     }
7711c0
-- 
7711c0
1.8.3.1
7711c0