From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67DDF606A31A for ; Tue, 1 Dec 2026 11:35:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=4ZQhmGRg; dkim=fail reason="signature verification failed" (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=iW4QzKWt DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To:Subject :MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=3rv0UUpZnJOudmL1g9ygIc7po1P2oBEVe9OUpVZoa2s=; b=4ZQhmGRg1AsU9vbIBke6oL2ysu tqzmm7XNd6SctasCAAPgcm8Ss9OJVNHQr0/wFIGs4fR9AZdwG2XHSRknfxmGPSZm1KeoT9GvcPYEK g5LfcMjgUF1oBX1RcWXVj8zIxFu6zpq4IJ5XXAjXcZ9o/5SWYHvQOHSgDnVrqGIlCXltcTMwp4X4Z Hf5pTr6Saj9NJUBOxHrN/q1e2wPvWMvHfXGHSfpo+2LiLk2QEVl5nICSjSbl/w3InfCNnDVcVmf1r ftBLQIg3ijsG58Jn/7HBpWP+stj4hlCrvOC0bxr1VT2Ol7cuD5UKXNsmBXmoYqbhTPLugvoRTwzM+ 6vmrrfIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYM8o-00000007cNW-40n1; Tue, 01 Dec 2026 11:35:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYM8m-00000007cMj-1O9H for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2026 11:35:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8CBC01570; Tue, 1 Dec 2026 03:35:14 -0800 (PST) Received: from [10.0.154.42] (e121487-lin.cambridge.arm.com [10.0.154.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 09EFE3F7D8; Tue, 1 Dec 2026 03:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796124917; bh=DHrMmoVVr+k99zpr7pRqSX9dqDMufAzPfuzgr0yjJmg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iW4QzKWtQZkUsDcip5BsiTOlDKijFVcwXzYXz0kRH+xUTyOd9yvynsMCHNEY5oOqw D1i1gE1auJkVnOmA0ACpUfwIMbWN3Mz4+kZblLf1znLYjc/mCwfy3ZjwpsdiPr3rwI R+jTeUUqEXnrt55UB4aOkA77aSx+ozaZJB6IUgGI= Message-ID: Date: Tue, 1 Dec 2026 11:35:12 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 00/39] arm64: Add support for FEAT_NMI To: "Kiryl Shutsemau (Meta)" References: <20261112132042.129062-1-vladimir.murzin@arm.com> <58a4c350-539d-49ca-826f-d19563895a29@huawei.com> <17149b32-6b9c-4364-b664-5789f0633e9d@huawei.com> <57757469-2545-4fc6-a7be-ccc133555052@arm.com> <38d04e8b-2f31-4616-8a8e-2747c7ce114d@huawei.com> Content-Language: en-GB From: Vladimir Murzin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_033520_483698_79A490D8 X-CRM114-Status: GOOD ( 34.27 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Jinjie Ruan , liaochang1@huawei.com, ashok.raj@oss.qualcomm.com, maz@kernel.org, will@kernel.org, lpieralisi@kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi All, On 11/19/26 16:07, Kiryl Shutsemau (Meta) wrote: > On Thu, Nov 19, 2026 at 02:50:50PM +0000, Vladimir Murzin wrote: >> Any chance you can attach debugger or collect traces so we know what those >> CPUs are doing? > I think they are idle with SDEI masked when the broadcast lands, and > the firmware leaves them unable to take interrupts. > > A CPU entering a power-down idle state masks SDEI from the cpu_pm > notifier. If event 0 lands on it while it is masked, TF-A's > handle_masked_trigger() returns for event 0 without EOI: > > CPU A CPU B (power-down idle) > cpu_pm_enter() > sdei_mask_local_cpu() > sdei_nmi_raise_backtrace() > SDEI_EVENT_SIGNAL(0, CPU B) > EL3: sdei_intr_handler() > acknowledge the SGI > handle_masked_trigger() > // event 0: return, no EOI > cpu_pm_exit() > sdei_unmask_local_cpu() > > The SGI stays active, so CPU B runs at the SDEI priority from then on: > no Non-secure interrupts and no more event 0. Other CPUs then hang in > csd_lock_wait() on their next synchronous cross-call to it. > > I reproduced it on QEMU with TF-A v2.15 minus the check described below. > > After event 0 lands on a masked CPU, ICC_RPR_EL1 there reads 0 and stays > 0 after SDEI_PE_UNMASK, and RCU reports "1-...!: ... idle=c078/0/0x0 ... > (false positive?)" as in Jinjie's rc3 log. With an EOI added on that > path, the same test passes. > > That path has been in TF-A since the SDEI dispatcher was added and is > still in master. TF-A v2.13 made SDEI_EVENT_SIGNAL refuse a masked > target, which leaves only a race with a target that masks after the > check. > > A fix is under review: > > https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55414 > Thanks a lot, Kiryl, for root causing the issue! > Jinjie, what is your firmware based on? > > Two checks would confirm it: > > - does dmesg show "SDEI_EVENT_SIGNAL to CPU N failed" after the > sysrq-l? None means the firmware accepted the signals to masked > CPUs; > > - does the broadcast work with cpuidle.off=1? Without power-down idle > nothing masks SDEI, so all CPUs should answer. > > Ways out I see: > > - Firmware: end the interrupt on that path, or keep event 0 pending > until unmask as 55414 does. That is the real fix, but deployed > firmware will not have it for a while. > IIUC, the fix is making its way into TF-A and is also being considered for an LTS backport. That should make it easier for vendors to pick it up in a firmware update. I'm not sure a kernel-side change is justified. We can't assume that affected systems that miss the firmware update will get a kernel update. For those systems, we seem to have a workaround already: cpuidle.off=1 which we might want to document. Regardless of this issue, I think it would be worth documenting how Linux uses SDEI, including SDEI NMI. The intended use cases, firmware requirements, and limitations are currently spread across commit messages, code, and mailing list threads. That makes them hard to piece together and interpret :( Cheers Vladimir > - Kernel: never signal a CPU that has SDEI masked. The signalling CPU > and the cpu_pm notifier can handshake: the sender marks the target > and IPIs it instead if it is already masked, and the notifier > refuses the power-down state while a signal is in flight. SDEI keeps > serving every running CPU, and the race goes away whatever the > firmware does. It needs a hook in arm_sdei.c. > > - Kernel: send the IPI first and SDEI only to the CPUs that do not > answer, as smp_send_stop() does. Simple, but then SDEI runs only > when a CPU is really stuck, and a problem like this one stays hidden > until the day it is needed. > > - Kernel: use the NMI IPI when there is one, as you suggested. That > takes SDEI out of the picture where FEAT_NMI or pseudo-NMI is in use, > but not on machines without them, which are the ones SDEI is for. > > - A switch to turn SDEI NMI off, like Jinjie's patch, as an escape > hatch whichever way this goes. > > Any comments? > > -- Kiryl Shutsemau / Kirill A. Shutemov >