From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:35899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gr5GJ-0002La-IQ for qemu-devel@nongnu.org; Tue, 05 Feb 2019 13:16:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gr5GH-0003mE-CO for qemu-devel@nongnu.org; Tue, 05 Feb 2019 13:15:59 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:38246) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gr5GG-0003XX-U0 for qemu-devel@nongnu.org; Tue, 05 Feb 2019 13:15:57 -0500 Received: by mail-wr1-x435.google.com with SMTP id v13so4716360wrw.5 for ; Tue, 05 Feb 2019 10:15:39 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 5 Feb 2019 19:14:20 +0100 Message-Id: <1549390526-24246-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1549390526-24246-1-git-send-email-pbonzini@redhat.com> References: <1549390526-24246-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 10/76] 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