From nobody Mon Feb 9 23:02:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) client-ip=209.85.128.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1631467659; cv=none; d=zohomail.com; s=zohoarc; b=NdNGi/Op/ZLGphyGZYOK768Na/1IFvgmePDzKrfVtXWJMNieoNX4AHhaMWO9eCESUDEzPrGhMKXsPcScCEyPeznNzxwMmn62WUSuZB4MmGWKC7AR3WALdJFWTK/RTyqWxI7TblGMetmDFysWdLvadMYThhip/397Ivu73VNZUwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631467659; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hznr1enLR5pCymS6G0/T6ANjmCPH0tNvUkpSC3Ehl/E=; b=Jk5ebe1wJXJLH+8blySud4u9HI7RRtyfYxPd5l1WkA1GHBApanAlBiC6TKwnOlfgs6kUxt1cQckBnXG3DjmDcADjSy97vtjKC0c/+g0LP1tUZZPHCUVZlYwd+7DNejLqw6E7wzv7QXz5wpz+8SrPQ6+bBFBT+AVDvksoYiW4SIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.zohomail.com with SMTPS id 1631467659718256.81125648157285; Sun, 12 Sep 2021 10:27:39 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id y132so4955187wmc.1 for ; Sun, 12 Sep 2021 10:27:39 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (21.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.21]) by smtp.gmail.com with ESMTPSA id n7sm1430516wms.18.2021.09.12.10.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 10:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hznr1enLR5pCymS6G0/T6ANjmCPH0tNvUkpSC3Ehl/E=; b=im7Mnn+qOc9w2X0y+rTgrRRxw3YfVjnoeZDKdxVNqh4fqJArT2dNnBQU49rCYZrBLn JSU5ZFHuu7xeAIAB1+NbpE/EtMlmSDK4lc9C+rd3srntEjM0PHgBH1KiTtbH9UI9zAU3 lMd8KpuIujlBVc7fVTTdJV42GluD9I6dcyC7xxkGcGJxj3AGpDL4aRQw7fHb+5Wc9PkP q/OM40baSuwX85y6NOnbddDF7YVougk76zYchTpAYTia2whaMq6R0UcQOoIJqHbHCQOr h95z3L2RuPF+7AMTPBZDWmw5aX+HakfYDdBCuxRXbrrMqJExeNXAIQU0PDDptSXj30iR t4fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Hznr1enLR5pCymS6G0/T6ANjmCPH0tNvUkpSC3Ehl/E=; b=xQIc5c60EVoJbFiK4MTdnUwlAhZAoJ+xDzpPranwLhd5sv7AM10c41MMHk7gm5qgl+ oYMZjkme0tKPRF4/65oJ92XmET20rQBE45CXngJlwPhhu5S8z0E+eHPdIsk4h6/0lz1Z Y134/DYMctPV0vSJ009hc3iiDAv7WKRkirhUnHF3bu8h2xqB4yc/Nb3NmEhM+zluKroN jAe9b7HrRnVRFF5Qwys01BY/YuTkTOjWKtEmeFoFpb909riUgdLv/vFHopXc168eONhX AYa5sVOk9fAfwvVVCPWnaeO6W8h32cZNgACBX4bm0Z8QvrENLRBIBQb8UkP3DJTFFrsf lYDA== X-Gm-Message-State: AOAM530j1aCpQ+Wn5f3La7OSgA8SK9JkJwYZokJdWHT0IOLPyUsSPv/G 37RbrWHjooEU8de2s7ZT7k0= X-Google-Smtp-Source: ABdhPJxssmu7BFSNldHZup/ECLEMfAWqoFnDzjEi30v4Uz2DBrgfIpNZ4Sv/X+MQ2jWwelUZDaZFzw== X-Received: by 2002:a1c:a94a:: with SMTP id s71mr3428443wme.32.1631467658043; Sun, 12 Sep 2021 10:27:38 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Gibson , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 01/30] accel/tcg: Restrict cpu_handle_halt() to sysemu Date: Sun, 12 Sep 2021 19:27:02 +0200 Message-Id: <20210912172731.789788-2-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210912172731.789788-1-f4bug@amsat.org> References: <20210912172731.789788-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1631467661930100001 Commit 372579427a5 ("tcg: enable thread-per-vCPU") added the following comment describing EXCP_HALTED in qemu_tcg_cpu_thread_fn(): case EXCP_HALTED: /* during start-up the vCPU is reset and the thread is * kicked several times. If we don't ensure we go back * to sleep in the halted state we won't cleanly * start-up when the vCPU is enabled. * * cpu->halted should ensure we sleep in wait_io_event */ g_assert(cpu->halted); break; qemu_wait_io_event() is sysemu-specific, so we can restrict the cpu_handle_halt() call in cpu_exec() to system emulation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- v4: Reduce ifdef'ry to cpu_handle_halt (rth) --- accel/tcg/cpu-exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 75dbc1e4e33..5fd1ed34222 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -588,8 +588,9 @@ static inline void tb_add_jump(TranslationBlock *tb, in= t n, =20 static inline bool cpu_handle_halt(CPUState *cpu) { +#ifndef CONFIG_USER_ONLY if (cpu->halted) { -#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) +#if defined(TARGET_I386) if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { X86CPU *x86_cpu =3D X86_CPU(cpu); qemu_mutex_lock_iothread(); @@ -597,13 +598,14 @@ static inline bool cpu_handle_halt(CPUState *cpu) cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); qemu_mutex_unlock_iothread(); } -#endif +#endif /* TARGET_I386 */ if (!cpu_has_work(cpu)) { return true; } =20 cpu->halted =3D 0; } +#endif /* !CONFIG_USER_ONLY */ =20 return false; } --=20 2.31.1