From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9338C3E92B4 for ; Mon, 29 Jun 2026 15:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782748466; cv=none; b=GsIVHdkomgS+CmExQ9OpUJiG2Es7qYTR/sxRZ79Jkxiito/42tDNtXYgDqrcxkjYk+ZxrlZIPK514JM68zFA+pZIDi3qY6UcuaJ3nY/ibY3PDZgzIIMwHgsfjdsEExnUutyXFqooThB/37Wg2n5kDwSK1xgS93vFf/Dz6a10dhs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782748466; c=relaxed/simple; bh=PEmFDKBgCksf81j7VvtfZ7vWMDUHtqYjKsy1c3eLLHc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UTXgE/rCAz/pCzjK3nN/PgHEcXq034E5vbtReVruTaAufR9g2EXog86GVF3JUcFdvztBXXTXcOIWl52PMHfXKL/S+QFnp4XXKACQ0Mls6+68KrreU5dBmGYQRl7b+cA8JOyuDrlZcgBRC1Gtucaa2aO+RZuZfJIoZAuhZkbAGzs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=q1Ds7g8L; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="q1Ds7g8L" 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 56B93339; Mon, 29 Jun 2026 08:54:19 -0700 (PDT) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E9C053F673; Mon, 29 Jun 2026 08:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782748463; bh=PEmFDKBgCksf81j7VvtfZ7vWMDUHtqYjKsy1c3eLLHc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q1Ds7g8LQm/f/sRY3aU8CRxFBcAhXW5+3DKKrIdJnaV+H333kFK30OtA740u8lsQq 2IpCqmDqJNRRLqAChO9LN4I1enJxHu5S2gEbGoT7vbXJxNI84W4Tq+RT22YtWNWJXj F2D2POYOIFlmQpXS7/BHGFY3vpHzOTb0vAudG+hU= Date: Mon, 29 Jun 2026 16:54:18 +0100 From: Catalin Marinas To: Kiryl Shutsemau Cc: Will Deacon , James Morse , Mark Rutland , Marc Zyngier , Doug Anderson , Petr Mladek , Thomas Gleixner , Andrew Morton , Baoquan He , Puranjay Mohan , Usama Arif , Breno Leitao , Julien Thierry , Lecopzer Chen , Sumit Garg , kernel-team@meta.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 0/4] arm64: cross-CPU NMI via SDEI Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jun 29, 2026 at 02:05:14PM +0100, Kiryl Shutsemau wrote: > On Fri, Jun 26, 2026 at 08:40:57PM +0100, Kiryl Shutsemau wrote: > > But I have not tried calling CPU_OFF directly, without completing the > > event. I assumed it is required. Will give it a try when I have time. > > Tried it now, and it doesn't work either -- in a more interesting way. > > Calling PSCI CPU_OFF directly from the SDEI handler (event left > uncompleted) reproducibly breaks the kdump capture kernel, and this > reproduces under QEMU's TF-A, not just on Grace -- so it isn't a Grace > firmware quirk. I had a quick grep (with the help of claude) through the TF-A code and it doesn't seem to be compliant with the spec. It should subscribe to the PSCI CPU_OFF event and complete the SDEI but it doesn't. It seems to handle CPU_ON but that may not be sufficient. It only EIOs the SGI once the OS completed the event, which doesn't happen if you issue CPU_OFF. > The test: a CPU wedged with interrupts masked is stopped via the SDEI > rung; its handler calls __cpu_try_die() instead of parking. A/B in QEMU, > changing only that wedged CPU's handling (everything else identical): > > - park it (current series): capture kernel boots fully to a shell. > - CPU_OFF from the handler: capture kernel hangs in early boot, around > SDEI re-init, never reaches a shell. > > Powering the PE off while its SDEI event is still active leaves EL3's > dispatch state dangling, and the capture kernel trips over it. Completing > the event first and then CPU_OFF -- what I tried originally -- silently > wedges EL3 on Grace instead. > > So both routes off fail, and the CPU stays parked. The dump is complete > either way; only re-onlining the stopped CPU in an SMP capture kernel is > lost. It's a cheap QEMU repro now if anyone wants to dig into the EL3 > side. Have you tried SDEI_EVENT_COMPLETE_AND_RESUME instead? Just COMPLETE won't return to the kernel. We have sdei_handler_abort() to complete the event and, hopefully, you can continue with the CPU_OFF. It's a work around the TF-A non-compliance but I think this is useful even if you don't issue the CPU_OFF (e.g. no CPU hotplug, just the park loop). -- Catalin