From nobody Mon Feb 9 23:17:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) client-ip=209.85.221.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632476340; cv=none; d=zohomail.com; s=zohoarc; b=cOdz3r2Eb8tmdOtoFAhAJjtdsgsXgMFY/JM9ViBkfyWrebd3pxbxPDpUxnlza6EnOCMmeXpL4aPT1zb5pOOclnFCOvDs8WhNMC903RD1O0yKZZa56Z1miRLhQfV1DtautEa99neCU7GEkHeviHSNPx9LNnzLXawRL16/Dj5aBUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632476340; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v/6Xo0TImgBm2K/shdcIyB243lN4oaXhrr/liWYNm+w=; b=bvL0cODxYEoEPanVXpTHnnhlkuYzhxfX30CYsiTkN5UShWHrPQ/1dYivH7U5rLRaqntTJF/BT0DKFge7RwO3aIhA17pS5uAl2SKLsS2xrmT7w1p/zFHbFcEPwzYBHehTJkojbd9oC5TZNvor3TXYdtbrzQjZENeC9pHin2a1sUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.zohomail.com with SMTPS id 1632476340635138.09987311972884; Fri, 24 Sep 2021 02:39:00 -0700 (PDT) Received: by mail-wr1-f49.google.com with SMTP id r23so151311wra.6 for ; Fri, 24 Sep 2021 02:39:00 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id c14sm7622119wrd.50.2021.09.24.02.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 02:38:58 -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=v/6Xo0TImgBm2K/shdcIyB243lN4oaXhrr/liWYNm+w=; b=Pa9TAG3DJJNK60sjEqpoeDmA5Ja/hj8QumRUf3uvdx8KtTwf7Db64hlkgabldj/bgr w6UgkL2fGHrya1aOpmSDbYmhs0nmg1RfYZBuzVEx/l3pxiRslAE93ncb9NQ2owsY2RQV YAI9fUzxrQvJxCEToZvURcG28wKKOUFMXjt5ZycSM6W35BE4NFCIdVn71KZ6hpStsTkg hmjtGORbtz8XrFcfxWw2vkhckEz2pjbRztnT+y4lB1V/MqyRcl9FL4lFia6d5UlRxXBS yT8TkUGFNxvLS0iwxk6MK0yWevpgf4+8RPyykY2PKPeZSyJGK8A36kykXuJtSA32jfJQ OHGg== 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=v/6Xo0TImgBm2K/shdcIyB243lN4oaXhrr/liWYNm+w=; b=NiOXY/ntio4GSGjpRMkIaPQDzX4usZY4FcrTlDdoQ0IPs3te/nc4tQl0WLSbQRwIZU 5pm+02AUGYF5DHHM1Q1sJkNLodObfjX+j0pef+M9KMaf5vH4dIVg55sU7u5soob/ovIa JZ3b+MosIhJ1XSCRSxeZKvYu6A88urY3nhJefe7YUQFPAdcVtwPip5fuBvd8qhTm70Uz K42U+9UTqKoDEcfNS8gH2yDtZtEuZ2feUOsbpKKkrdICTXWgqk4mdVTBuMQP7zmr6ua9 xcj0rifNl7W6C10eUcu7DTGDHRiS6EKUZPm+nNjnqoB+IzGVxINFnZBySngf2y4PIGMm Ty3A== X-Gm-Message-State: AOAM532QfBsOQ9/JnbZqOI6wKU6QKZnDExL7YI2F6OqQMYjCBhzGbsj5 USpWgQDCeaEKJ3TX8yHeFmY= X-Google-Smtp-Source: ABdhPJzhrnXA0uhl2pqV0q5B3dpoBOUbVOmIkvNTuLFX1nY/29IPrGM2JLjn3E6eMtqMs62Y3cpC9g== X-Received: by 2002:adf:ef48:: with SMTP id c8mr10126026wrp.349.1632476338844; Fri, 24 Sep 2021 02:38:58 -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: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini Subject: [PATCH v6 02/40] accel/tcg: Restrict cpu_handle_halt() to sysemu Date: Fri, 24 Sep 2021 11:38:09 +0200 Message-Id: <20210924093847.1014331-3-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924093847.1014331-1-f4bug@amsat.org> References: <20210924093847.1014331-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: 1632476342531100001 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. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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