From patchwork Tue Sep 21 02:25:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514381 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2638657jao; Mon, 20 Sep 2021 19:27:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6fCSx7NZzV+uBtVOGhOVnPEGfuT4iDuMLkD//cmh63rUu1J2n3W+qLCXGvJQEw4d/Ub/J X-Received: by 2002:a05:6638:2493:: with SMTP id x19mr22004480jat.57.1632191226971; Mon, 20 Sep 2021 19:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632191226; cv=none; d=google.com; s=arc-20160816; b=cV6a85tAX4DrP4Tfmus1kh6ytm/AhmnI0N0o/fgYbGjfi57Uc0PeiT0gyzk1/pK4Vz /+MxMcGeoQvrb/pPvRD5lpvY6xUmf+62qeuGFvYyX50uHnaXO4b+yHWs4OfsVbvY8VD5 DLD3whNcejQLfWK2jQVvTOz7JIA8ISpVAznazT5KBM5Qq35DaR87E47hqFRJAn+/jTF6 rMoBk9QnKKi2NIpJ+B6G3J+RcWj0dsS362TGhL/nJF6PsK+sP6fD57iPT2keW/kMkv8C bDVuNx7BAMlbX7RgvrFe9/aNTglrh3kRZI5nTjpr0PBaxOM69nrq0INQpIt2cgwOrkNp hBqQ== 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=fwY9qmJxOyJZtdqF5IC/g1RIzg+SkJO9NJpiScrKL9iJ/7MiB79oYWXiMqB4TAFkMA Ov9zVqyrwfEVMosiYMDvYNGLX4glSXpFq/QN0Hg9N6gz70+917s1aVrm+ds+sliKaonq Fu+4QURSRuGpoh1/xbVb5x0AGU9oEykxyZmzRVR0TQrjRDsqAjcWAkfQrdRIhdOh1wnW Dxigp89JjgDg8Zxm6v42wQG9n5gFi9NIfRRC/uSP4dxUtbXRsVAcydEyFNcKV1bucm1z 4PbZHUtmG2DYAwQKAf5fMO28heV0/vYZzZ1zlgy3FsdbQ2dpemPlKrSI+2jUh6VZr2Q4 DkeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Eu17ZHQa; 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 p10si17778587ilo.160.2021.09.20.19.27.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Sep 2021 19:27:06 -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=Eu17ZHQa; 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]:59492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSVUw-0005Z7-EO for patch@linaro.org; Mon, 20 Sep 2021 22:27:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSVTa-0005X3-7q for qemu-devel@nongnu.org; Mon, 20 Sep 2021 22:25:42 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:44972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSVTX-0006Ea-7h for qemu-devel@nongnu.org; Mon, 20 Sep 2021 22:25:41 -0400 Received: by mail-pl1-x634.google.com with SMTP id t11so1833083plq.11 for ; Mon, 20 Sep 2021 19:25:38 -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=Eu17ZHQailOpYS2FVwL536MmZZntf/D80XjGDw27Qd3EVLYBsL1XVq/IA8mqkUtICW 7j/yVU2ljC30vxjUU3V/aqUADfiYohOF6iSwj7YNlrOnSv9vtwyz2KaDyvVFQXVRiCL2 yJUAdcmRzkeuDo7zj40Zkslva6qA7CPC7vGbKoHafu3UNA/flsxqZ5iVC8w7h4LwJ8TB jt3mOflRuF/SQk+UJuhAVbQ87E+rVF9P7SbzaHFjyMzh8OTzDpowcq5arrNln6ydyBY8 1ds0s1Lrsdy7RUWIudScdSflIbFsbFaBrMA/2bXxW1RT1+uwGcRMBjxaCywiljve/fO5 Wi5g== 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=uk6UlbcVHfm+x+loQjaYNKLr9WzhHKAJ2d+rMvXasot0/PBpdUQLZoSzNifOZDbBQY +FIsAWPwPxxmvdoCPK2/6Xaj+nEwiywXnpUFwhvX0qBrOo544Le/KcHMPTSrc+O2fuwV EFhUobb7/n0NvvNrwCsbVAWWQKNdaeRR73bCG+45Hb12hEgg1cz2fqTETF3f/0gXDbcy m664h44npuNj9w4Gl8ysuqSA56tYHyXy/6n6Nu7mRAY2N2rBSrleP85BnLiabw7teftp s+sC1/9dVlwjZDHZBwSKLosodgTD+FX91IveiDScfQSeXgFDWk6+Of+Y9u2vCvK9soZn LRKw== X-Gm-Message-State: AOAM532QdJb+ItL0MK2hnqZclyDABXQGVGKZh81DgSVaMwi5JoN4Vpk3 rgK4z0Z7l6Cz1ck2VTJGKiAhAohVJl8WpA== X-Received: by 2002:a17:90a:1984:: with SMTP id 4mr2423118pji.241.1632191137902; Mon, 20 Sep 2021 19:25:37 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id n9sm15297621pff.37.2021.09.20.19.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 19:25:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/10] accel/tcg: Restrict cpu_handle_halt() to sysemu Date: Mon, 20 Sep 2021 19:25:26 -0700 Message-Id: <20210921022534.365291-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921022534.365291-1-richard.henderson@linaro.org> References: <20210921022534.365291-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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; }