From nobody Mon Feb 9 13:38:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541541406255795.9213588067731; Tue, 6 Nov 2018 13:56:46 -0800 (PST) Received: from localhost ([::1]:43954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gK9Kv-0006UW-KP for importer@patchew.org; Tue, 06 Nov 2018 16:56:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gK9Cr-0002l6-Do for qemu-devel@nongnu.org; Tue, 06 Nov 2018 16:48:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gK93V-0001OE-WF for qemu-devel@nongnu.org; Tue, 06 Nov 2018 16:38:41 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:36807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gK93V-0008JR-42 for qemu-devel@nongnu.org; Tue, 06 Nov 2018 16:38:37 -0500 Received: by mail-wm1-x332.google.com with SMTP id a8-v6so13741234wmf.1 for ; Tue, 06 Nov 2018 13:38:07 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id l186-v6sm3223526wma.13.2018.11.06.13.38.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 13:38:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z2dLXAjqPsYiDE2KG3TA3x3OxiKYmk9EUCnKtZXwwok=; b=uR38xXc2FCafwcRWuISNhyg41/cNeFPowOGOLpKatrxv1LT8qRIKOQcklOgOG8iPaK bsrwtffvPhZv5dDednAntqJrf7y6274/jRuqVcEatr1GQOG7dqGYEIm+63hphAn1JAK0 NAOvGQLuma3jDYmX9uzR/ndb2SdtYS1ayQ5vuh3meoi4uZNfYzAJbUvGqMFOe912M7ic FQH5MxL1K9m7xdfcQDilvKipnvmIn7eglqVsMlgK80p7wCAUIx1GBeMlejx5Mmd+b0dh Q5E5mIPdyVhfi//5zWhxF96QLcTi5oDCPYULt9XcZyl5FS1a+3PaDVrhhMWNdk7AqBYY MV0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Z2dLXAjqPsYiDE2KG3TA3x3OxiKYmk9EUCnKtZXwwok=; b=PC6nPSYSyUDwx3oqBmVB+VE7urfFY4KhJp6ZC7pjzgwBuULzXwbbXHX7k8qvIJNm8Z umJt1eAUf/Bz2M+93mg+boLypG/yLrCaYOEHAwy7aFzDe/sJRA/Vd8T9F0IJm14YeVre ubDQHFqXXGzS6xOmvhnG3ZAW980dnXasame6BpQ6omso2hBQO0FneWY0IRH6IgBy2UTW sHhaUuLS6SUaDswQ23xBe5iTWvqOywNfQyxAgg65Nb2N5fcnLnjEnZ4q/U0XtVtIV5w4 6UxqX/eBKU5S+d4jPCwR/I5UtBRyhMfS65JgfzzsvNTpnioprQp9Lmk3PwDixyVfaBOm bxyA== X-Gm-Message-State: AGRZ1gIHQFVyu2w7POJi1S2m7pKxrBYcxdiTcXOEJ1TMk10q7vMNfzr4 IXRs1jZV/ezEOcVs9uwpYJyoc9tK X-Google-Smtp-Source: AJdET5emQIRB1D5jfdJcUsgVwnVsKujhye0u+e4Okfu9BJfA388Ptx5QJuh2MCacvx5qOpZQHEKv3Q== X-Received: by 2002:a1c:84:: with SMTP id 126-v6mr3227036wma.96.1541540286607; Tue, 06 Nov 2018 13:38:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 6 Nov 2018 22:37:47 +0100 Message-Id: <1541540283-45699-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1541540283-45699-1-git-send-email-pbonzini@redhat.com> References: <1541540283-45699-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 01/17] icount: fix deadlock when all cpus are sleeping 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: Clement Deschamps Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Clement Deschamps When all cpus are sleeping (e.g in WFI), to avoid a deadlock in the main_loop, wake it up in order to start the warp timer. Signed-off-by: Clement Deschamps Message-Id: <20181021142103.19014-1-clement.deschamps@greensocs.com> Signed-off-by: Paolo Bonzini --- cpus.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpus.c b/cpus.c index 3978f63..a2b33cc 100644 --- a/cpus.c +++ b/cpus.c @@ -1554,6 +1554,14 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) atomic_mb_set(&cpu->exit_request, 0); } =20 + if (use_icount && all_cpu_threads_idle()) { + /* + * When all cpus are sleeping (e.g in WFI), to avoid a deadlock + * in the main_loop, wake it up in order to start the warp tim= er. + */ + qemu_notify_event(); + } + qemu_tcg_rr_wait_io_event(cpu ? cpu : first_cpu); deal_with_unplugged_cpus(); } --=20 1.8.3.1