thebeanogamer / rpms / qemu-kvm

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