From nobody Tue Feb 10 01:34:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) client-ip=209.85.221.41; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f41.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632174300; cv=none; d=zohomail.com; s=zohoarc; b=HWROUCrXXce+wzUX8kdRB627xsgtdYrvpkE3xttjdnY0P8nOxJRJagS0m5sIc91M+vAORtC9/1Y9muyBlxArlLDvSY3WaV1eNHVY7mUzu15CMSoDrxnx2BnQaAJ9Y0KQqUUHTqzCKZzD0n4kScJeNc7XjFaIUO9xMerBEIY/eG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632174300; 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=J5ThPM6CSfykyW5V8FGZlpctvxO0ynFb32YMlIFlTtjKV8BnE/rfMXJAphg/K52hMRqnQqfWkwOpscyOaWbLoOyoRCvzE4P7xXOe5YJJaXH7BnVr6EA887UBc1Zx1d8/IOX7jYseFmU/feXAzvKIbIROCSvMYgM2LWBb87xujlw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.zohomail.com with SMTPS id 163217430029543.480616875505234; Mon, 20 Sep 2021 14:45:00 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id u18so31831668wrg.5 for ; Mon, 20 Sep 2021 14:44:59 -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 g131sm659592wme.22.2021.09.20.14.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 14:44: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=iyIiBpXaiDOtuVE5r/K3BHMNp+WKn6HJY/7/DoxzRV/dtmPN3DpKEiTIx2qTxrF18l wYndNYEJi6YyasCDTE7Xu45G9njLGisYV7HLeEKvc8J5LkWHEq+XKji+4VfDORWlCNCq 3DsUMR5YdZ769DP83Z3UCPvDP/mbBanSn5x4OoMEsWmQPb5zPchZqfep/9nfhfzJcFho btnnN089KttGxtEtb9buuCk+U0BSuBN9Xqw0J4HoNCyf+oib4w2jSCp5XeQJcFr96sA3 SIUpADWu+y3N1cA66UFpw3h6436On0HszQrzcUcm8SwO23jP7V187EuuUI54BWe6mGZj Ecww== 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=nF4mPxaFuODc0c8yGQb2S8FJ6ZDu1W+8T4fCeuWSXUw8QA6Sf+t/yJomrizFmuiK2P lQY3QwqZPFiy5eYag0SqTl4dQ3CrtMDkSM3CqT0qwSYF+j4LgSkNr1mU8q6lbA0xg1C6 RiCcWFiE8uUdKVk+ie90HvVC+mkSF9zk6dHaNDQayudpj89Tai1hSqFjhn0IfdC4Urzo bLfeOx082nPxv4Pa7VGpQOBIRFvOJTJbmEBVyf1dDdgiRZT4bjET6DtPXa0jGIMrsHNx ubmxR2XnMxXLMjZTVUcraViVoMVZ+cZvkCKbYZh+2veAkDytmT4TOQNGKM5V+QU/DdP0 Z8nQ== X-Gm-Message-State: AOAM5333OwEVIhq8Wm6TM+j/f65AFgCutwJE1tC1o9VrrdqECfWwtMfv w4smM+C6yjo9EKRt+vQNCUY= X-Google-Smtp-Source: ABdhPJx7QboejQArc3/bdNfXSm2K8eVuMBb1inDD6MguUTeVbEvyJZ1q26RbGJKVHz+41wiDoxaQdw== X-Received: by 2002:a7b:c104:: with SMTP id w4mr1128402wmi.160.1632174298541; Mon, 20 Sep 2021 14:44: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?= Subject: [PATCH v5 02/31] accel/tcg: Restrict cpu_handle_halt() to sysemu Date: Mon, 20 Sep 2021 23:44:18 +0200 Message-Id: <20210920214447.2998623-3-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210920214447.2998623-1-f4bug@amsat.org> References: <20210920214447.2998623-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: 1632174301460100001 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