From patchwork Thu Sep 16 15:29:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 512941 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1325523jao; Thu, 16 Sep 2021 08:34:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmXVVLoOU+62RRHdRrSbx2+rNlp3PQgpD/0nsaJs1dt88yzz8bu1RoiBKiU54ouBLZjufF X-Received: by 2002:a05:620a:4404:: with SMTP id v4mr5748029qkp.344.1631806498687; Thu, 16 Sep 2021 08:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806498; cv=none; d=google.com; s=arc-20160816; b=SWhl9VR0xa3Rr+5wTZpX93iQXIFXJPA5lAMdGz8HrK6qdHcxKnbsMm0Yao7s2nh/ps mTy7gZr2z2DE/lgoG0B4sf7KFolRR8NC46wHxnxs1CCOUdCKDhX/RU+xMpSATN4MVUZ9 ImLb4WdzilXPGHOaRvaor/YbHnYU3XFpbPwvjcWZGkprfEzLWig11vUO5GHnPIlbt3St LVPBVVPKTdJWnu9ZFydBgdg5Z48xzK6maaTw8J7lTo4tXkgvVBB0IqvR1UriZykxts+X 3NeFQqv42Sqp97FqKBaxlA6MFJ/T0hxGWwbkCh7Wf3L1ClARCllOI+rNZxULBvDWkxO3 tI7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=4+zrbrroX1D6vS/SQV3E4mdDvw0CWYvps+W1iwdat2U=; b=dNKXV0T42hShTl2WFkaQ2h4ZFn6UrNnN8ZKxY4deFeYc0TNzypt7ZG+40Ng3SN7Gfm 8xeDGAsJOTl8WRlZor3ctskIhNhf1XAqFfXmYi3YCdDaG5FwO2gB7MSSNS51vL0J/lFi ixx0CMQUXjnLgysgfPuJAjN5T8Fw+eTrwgZHZ97ZVnn0O+lZ3u/knGvu3eFhlzGHC1ZF vSQd4oj3+cVJQtN1geNPWwZ/9SZXqW41h6fXbbaCuvTAIbecJSCaa1P3XQ1vRlIp4AOU Rf8ljKhVitIzgvLSHc1yJ0ticFkt6ivX29ygGqAdktZTv5+lZ8xtw83DrbYBS4Bup0sI ULAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yjmIsUl9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j13si1835298qki.159.2021.09.16.08.34.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Sep 2021 08:34:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yjmIsUl9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQtPe-0005Jl-7X for patch@linaro.org; Thu, 16 Sep 2021 11:34:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQtLM-0001Ds-9u for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:30:35 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:46876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQtLK-0002Mf-CM for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:30:32 -0400 Received: by mail-pg1-x529.google.com with SMTP id w7so6441582pgk.13 for ; Thu, 16 Sep 2021 08:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4+zrbrroX1D6vS/SQV3E4mdDvw0CWYvps+W1iwdat2U=; b=yjmIsUl9SCGcAdlA4RzFE2AkEQZyx1XSdMJmFBpEgas3D9QBN3H43THHkqMHC1Adj3 PsOxF3AFxa6w86E4rungnP6MpHanLcwuZ8l72s7oPT09PR8Qu2rOfSPQDm3mXdSv8GU4 jdXkJS30MhTnEFLCSoTWAupFrgO3Vu/pG5YuWArJQi55q5g0HjQkrYQLEFB6yrl7LOnW fzOqRtSDvM4IoqQP1xULtkdIXGyw8CfbIOwCCBGXZkxlcBFZW0WswX+8WZ8YzZ/d8GK2 swVSTOQ8XZ/5eslyK+HI5PUDhnyXmAJl/WAZc1YTvcZU9JvhgfCGem2jQoavINeKa384 7+Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4+zrbrroX1D6vS/SQV3E4mdDvw0CWYvps+W1iwdat2U=; b=R7OUZ6xjllbDnL2gCfvgUaDjDX55FDxfxAcMW1tjerX6TzW40x9B2Fd77by+U+IfGw 752g0YLWrG0r1Q+hl3KDYhASYr46iEJbbT+bf3KhwZ2jfwmFFwVFPpqcJKIHWsZBdJIf zseuID1/fNce7+8JEzCnry8PG5hULY/Ard+7kuTKxUJ3BJYLpZ171/aj6A+0YnJ5rK7m VORTqB7iH3CI5ancyrcA77Y4hwTK5XON5WGvW4i72VseTyWnSTfp6jTd6YckSaCMTkYo BiFvME+SZ1R7uP910TmvH2Srk9jQp0INCGntd1iIDyEWxdn9OXA4WVWx5VgEw3xfPXRD u61w== X-Gm-Message-State: AOAM530evjeBuFGgkOU4yMjkAaa2cOJM6aFbUEuk6tLd+ldP7iAAbCE5 POZLyRCZDTO59Y6yB81Ag8MsCy/FwFN8Zw== X-Received: by 2002:aa7:9395:0:b0:438:9980:5c94 with SMTP id t21-20020aa79395000000b0043899805c94mr5752945pfe.81.1631806227746; Thu, 16 Sep 2021 08:30:27 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id b7sm3779447pgs.64.2021.09.16.08.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 08:30:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/35] accel/tcg: Restrict cpu_handle_halt() to sysemu Date: Thu, 16 Sep 2021 08:29:52 -0700 Message-Id: <20210916153025.1944763-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210916153025.1944763-1-richard.henderson@linaro.org> References: <20210916153025.1944763-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é Reviewed-by: Richard Henderson Message-Id: <20210912172731.789788-2-f4bug@amsat.org> Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 75dbc1e4e3..5fd1ed3422 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; }