From patchwork Wed Jan 2 14:16:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1020005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43VCpH2vMZz9s7T for ; Thu, 3 Jan 2019 01:18:45 +1100 (AEDT) Received: from localhost ([127.0.0.1]:45093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gehM2-0004OM-M5 for incoming@patchwork.ozlabs.org; Wed, 02 Jan 2019 09:18:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gehJk-0002lO-Oh for qemu-devel@nongnu.org; Wed, 02 Jan 2019 09:16:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gehJf-0005nW-4j for qemu-devel@nongnu.org; Wed, 02 Jan 2019 09:16:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gehJa-0005jT-Q2 for qemu-devel@nongnu.org; Wed, 02 Jan 2019 09:16:11 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CBAEC7BDBF; Wed, 2 Jan 2019 14:16:06 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-204-113.brq.redhat.com [10.40.204.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D7E75D9C5; Wed, 2 Jan 2019 14:16:04 +0000 (UTC) From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 2 Jan 2019 15:16:03 +0100 Message-Id: <20190102141603.3681-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 02 Jan 2019 14:16:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] cpus: ignore ESRCH in qemu_cpu_kick_thread() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Peter Crosthwaite , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Philippe Mathieu-Daudé --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 0ddeeefc14..4717490bd0 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); }