Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4E89E99062 for ; Fri, 10 Apr 2026 09:36:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wB8H5-0008Eg-N4; Fri, 10 Apr 2026 05:35:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wB8H4-0008Cw-8h for qemu-arm@nongnu.org; Fri, 10 Apr 2026 05:35:38 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wB8H2-0001n7-N1 for qemu-arm@nongnu.org; Fri, 10 Apr 2026 05:35:38 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-43cf73bbfbdso1109320f8f.1 for ; Fri, 10 Apr 2026 02:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1775813734; x=1776418534; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7C9hC6oP3HzpI0ngIK4XeOqugtTl46bkPiAd+X+8QzE=; b=nB6G94NDdNRuKgTn/tpMz447RkIRrfYFSAhRkwywhOJk5hmD+4x+/1spo0M05rBMcD D2luNtDQXc8wMR95U3n6zy/D4LdKWD0wdJpVq6qjR59fGclCTTFmgoXa8vQA7fTxKg+A JPXr1EwjGkRQaeC306a2zE6zjebl0pQjUjVED2Th4GRNOHGs9SQKbhPFsD2X0kPKAvtU MkP06ldVYC4DJpCLFAKFdNoemR96A2LJqbydrD+eeo/JBcXZbKd7/Q9zmJ2yb7J2ljPz yoM2SuwbQExFz95zNjr0WdenmOd4at7coBmy/NW1erI4E7+Jj1iKttILpY++4do3vd2b qQRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775813734; x=1776418534; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7C9hC6oP3HzpI0ngIK4XeOqugtTl46bkPiAd+X+8QzE=; b=T1gr+QaMpcTtL15gfOdWEbl+RBSO8LKW00wjERyjxT+Sg1C+XNcYa5CZOC2RjYw/W7 GmPNOk9gKvDG4XhFn+G+yIgS/ZEuEVHzVuRXk70hiitoMhXNTzgveNO5owYO8u9onLlP k4I0HaUoB9lMw2B/FOnjOkM0ucRuGBGMyIxUz7cPDxLoz7f5crH+eV8QMcRUfuv0R9GZ EeaqPl1R6WYKXmxbPHNsFAbcnFfPjS+ew5+tkI7L5v+ylO+yu1pX8H6PyNaLripaMsQJ fO0UOUWF1pGPDQQo+vj/yjcI9JtWuXdeYBGwZkAvSnQxL++qH1itYxtXoViX2VBiPTKx B1zw== X-Forwarded-Encrypted: i=1; AJvYcCUUqtxn3K7uYBKfKgUpSyXknKs6JVv9jeccKJ3SBhkq9HoOQ+ioG60ifJ0l1p7qyNfGuNq4OjA8cA==@nongnu.org X-Gm-Message-State: AOJu0YwjfaOfFajSRYlqbEG/7totrFyGA11SPy1fVtlbO2gcv1BDY5zY lEnlLiFvEQ+IEBM1YMFz0BKKwMVCXYg7v+CPfE8wtWc7yu55i13DodZDz2keq328nJU= X-Gm-Gg: AeBDiet26Azl/PB28HWGAu0ZjnszC9nDw+VMicOCGxMkIKH/B0joVK/KI3AJbFhms6k YvzGXR/i7CgGWvN3CgtnU21KVhzVLb5ns7sFADqIFFD2vPHzxAbuV9iDf6fPXbduKRAKdmt56Ls ohOYJulvG4n4KqhEwUwTqC4Q8DPb6kQcSoJjbWMgvw1VJBEyZlKO04rC6WtnsTdWRtw/C1xqAE0 Zm+rs4JBtymZrVOjUBTj3wSb6z+1lB9BIXPApvwPQ29C7MFWpDw1Egj40FVveARz0xc51wUV9hc PKP0rKH30BJNSaHyxOh6QOCtBA5GccmHkJqFnQUdkrzS0RnEBonTX7HeZmrvOvfwYwhtW+KNvbq O4HLxUbgjN3FtKAtF2KAi8ie4MmfgtZl7QZ85s6xh/VVuGoQWYYMWZuaFRO42bnDUlAiK31FV7u QZrMB9SMwMnY2CyJFwJ9HNxKE= X-Received: by 2002:a05:6000:2408:b0:43d:1c75:db70 with SMTP id ffacd0b85a97d-43d642537a8mr3499576f8f.15.1775813734403; Fri, 10 Apr 2026 02:35:34 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63ab84cdsm6186656f8f.0.2026.04.10.02.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 02:35:33 -0700 (PDT) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 020CC5F830; Fri, 10 Apr 2026 10:35:33 +0100 (BST) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, Alexander Graf , qemu-arm@nongnu.org, Pedro Barbuda , Mohamed Mediouni Subject: Re: [RFC PATCH 24/35] target/arm: remove event_register check from arm_cpu_has_work In-Reply-To: (Peter Maydell's message of "Fri, 10 Apr 2026 09:47:36 +0100") References: <20260320130607.2071996-1-alex.bennee@linaro.org> <20260320130607.2071996-25-alex.bennee@linaro.org> User-Agent: mu4e 1.14.1-pre1; emacs 30.1 Date: Fri, 10 Apr 2026 10:35:32 +0100 Message-ID: <87h5pjjgyj.fsf@draig.linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Peter Maydell writes: > On Fri, 20 Mar 2026 at 13:16, Alex Benn=C3=A9e w= rote: >> >> The generation of events are not indications of work to be done and >> importantly for the case of WFI instructions not a reason to wake up. >> Remove the check. > > But an event *is* a reason for WFE to wake up, which is why this > check is here. In particular, the thing that tells accel/tcg > that the CPU should come out of halt (via cpu_handle_halt()) > is whether cpu_exec_halt / cpu_has_work returns true. If we > don't check the event register here then another CPU setting > the event register won't cause this one to come out of WFE. So for the same-CPU case we do because we signal cpu_interrupt(cs, CPU_INTERRUPT_EXITTB) which is enough for has_work to return true but I can see the failure mode for cross-cpu SEV's when we kick all vCPUs in the helper would get stuck. > If we want to have WFE and WFI wakeup events to be separated > such that only WFE wakeup events resume a WFE and only > WFI wakeup events resume a WFI then we need to do something > more clever here, so that we track whether we're halted for > WFI, WFE, PSCI-power-off or whatever and our has_work function > can check the right condition. I guess we can add a cpu->halt_reason? I've already had to add a cpu->waiting_for_event for arm_wfxt_timer_cb and I guess it would be better to generalise that. > (Side question: are the only > cases where our arm CPUs halt WFE, WFI, power-off, or are > there any others I forgot about?) The only others I can find are debug events which all have their own logic (and we don't have "external" debug events modelled). YIELD is still a NOP and not really a sleep. > Incidentally, looking at the code above it will need fixing > for A-profile anyway, because a CPU in PSCI-power-off should > not be woken up by a WFE event. We get away with doing the > WFE event register check first because M-profile doesn't use > the PSCI powerdown stuff. Ok, that seals it. > > thanks > -- PMM --=20 Alex Benn=C3=A9e Virtualisation Tech Lead @ Linaro