From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:51785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gldyB-0004RM-Nu for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gldyB-0004FX-3D for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:47 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:56124) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gldyA-0004DS-TM for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:06:47 -0500 Received: by mail-wm1-x32c.google.com with SMTP id y139so11637896wmc.5 for ; Mon, 21 Jan 2019 10:06:46 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 21 Jan 2019 19:05:53 +0100 Message-Id: <1548093980-43088-23-git-send-email-pbonzini@redhat.com> In-Reply-To: <1548093980-43088-1-git-send-email-pbonzini@redhat.com> References: <1548093980-43088-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 22/49] cpus: ignore ESRCH in qemu_cpu_kick_thread() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laurent Vivier From: Laurent Vivier We can have a race condition between qemu_cpu_kick_thread() and qemu_kvm_cpu_thread_fn() when we hotunplug a CPU. In this case, qemu_cpu_kick_thread() can try to kick a thread that is exiting. pthread_kill() returns an error and qemu is stopped by an exit(1). qemu:qemu_cpu_kick_thread: No such process We can ignore safely this error. Signed-off-by: Laurent Vivier Signed-off-by: Paolo Bonzini --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index b09b702..154daf5 100644 --- a/cpus.c +++ b/cpus.c @@ -1778,7 +1778,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu) } cpu->thread_kicked = true; err = pthread_kill(cpu->thread->thread, SIG_IPI); - if (err) { + if (err && err != ESRCH) { fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); exit(1); } -- 1.8.3.1