From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02E9CC4332F for ; Fri, 24 Sep 2021 09:41:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B62E60E97 for ; Fri, 24 Sep 2021 09:41:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B62E60E97 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:53256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mThi5-0005ul-MO for qemu-devel@archiver.kernel.org; Fri, 24 Sep 2021 05:41:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mThfZ-0002kD-Jg for qemu-devel@nongnu.org; Fri, 24 Sep 2021 05:39:03 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mThfY-0005wS-9D for qemu-devel@nongnu.org; Fri, 24 Sep 2021 05:39:01 -0400 Received: by mail-wr1-x434.google.com with SMTP id d21so25358911wra.12 for ; Fri, 24 Sep 2021 02:38:59 -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=19JEwu3rA27yTIDVR3roKxgXrPRvj6vgsTCsCzVw64C9Qr5KzWtA6CKMF2x9mNEx+Q 3QL23IBTY77fn6RMUnrhDIZt5u/x3XFYcVs5CQdO2y2vNbhAlGBm+b7Hzu+vwT/fcgHm AWybPdh1DzYW0ZXMAOitp8xBwG6RMUDE0oxN5OIFHXSQlMOFiSL226o2p4psdIU130f7 IB2BdHeWmO0HbAHpqDsvFs/HCzZ9u+P0rsry1oNDcUa0DvujT7z3SY2m3bzpt/vlyONa ukPKwzD/lkJrg4bhUHysKOxzV9C3/FREHQKWAKC8UVt3UKbfHLN/la76LFmDiqpNJoDB YDzw== X-Gm-Message-State: AOAM531lsOdZXvTyQsVttzXSAV3RItNsWp3vwd9RSIsLcjHe4LyXhzHb mcp+WYoYwNkRgLAP8ByzcFit2kKbBNU= 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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, int n, 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 = 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; } cpu->halted = 0; } +#endif /* !CONFIG_USER_ONLY */ return false; } -- 2.31.1