mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
To: Vladimir Murzin <vladimir.murzin@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>, Kiryl Shutsemau <kas@kernel.org>,
	Breno Leitao <leitao@debian.org>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	Doug Anderson <dianders@chromium.org>,
	Linus Walleij <linusw@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Huth <thuth@redhat.com>, Dawei Li <dawei.li@linux.dev>,
	mrigendrachaubey <mrigendra.chaubey@gmail.com>,
	kernel-team@meta.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 3/3] arm64: head: set __entry_task along with task setup
Date: Wed, 18 Nov 2026 15:30:06 +0000	[thread overview]
Message-ID: <2ce350f9-4dc4-480f-8a53-07ef9586d49b@arm.com> (raw)
In-Reply-To: <f232d0ff-3286-4d85-b9e3-cad8c6bc7178@arm.com>

[Resending for the lists, as I forgot to disable sending HTML,
  sorry for the noise !]

Hi Vladimir,

On 18/11/2026 11:01, Vladimir Murzin wrote:
> Hi Ada,
>
> On 11/17/26 17:48, Ada Couprie Diaz wrote:
>> `__entry_task` is only set after the first `switch_to()`, despite
>> a proper task being set up in SP_EL0 as soon as CPUs go through
>> `__{primary,secondary}_switched()`.
>>
>> As SDEI can interrupt execution at any time, it can interrupt before
>> the first `switch_to()` and use a null `__entry_task` to set
>> its current task.
>>
> TBH I do not know much about SDEI, but don't we need opt-in for
> SDEI before we can get any SDEI events? If so, can we really
> receive SDEI event before first switch_to()?
>
> Cheers
> Vladimir

I honestly do not know much either !
But, looking into the driver, we register the SDEI entrypoint
as part of the driver init in `arch_initcall`, with a few notifiers
(CPU hotplug among them).
If using SDEI NMI, we register an SDEI event callback within in this
driver init, in `device_initcall`.

Both of those are done in "late" in the boot process, in
	rest_init()
	-> kernel_init()
	   -> kernel_init_freeable()
	      -> do_basic_setup()

This is as part of the init task, before excve into userspace,
but after kthreadd is set up and has switched to the init task.

So, I think that it is not possible to be interrupted by SDEI
on the boot CPU before the first `switch_to`, as we would have
`switch_to()`'d the init task by immediately scheduling
from the idle task.

However, as far as I can tell this is not the case for secondaries :
their first task on boot is set to the idle task, which they go to
without switching until (and unless) something gets scheduled on the core.
This would be the same path taken for CPU hotplug.



Unless I am misunderstanding something, which would not surprise me
given the amount of things happening before getting to init, I think
that is is indeed impossible to get an SDEI interrupt before the first
`switch_to()` on the boot CPU, but that it is on secondaries
or after hotplug.


Hopefully this makes sense and, more importantly, is correct !
Thanks for bringing the question up.
Kind regards,
Ada


      reply	other threads:[~2026-11-18 15:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 17:48 [PATCH 0/3] arm64: sdei: fix entry edge cases, pseudo-NMI Ada Couprie Diaz
2026-11-17 17:48 ` [PATCH 1/3] arm64: entry: sdei: always set VBAR_EL1 on SDEI entry Ada Couprie Diaz
2026-11-17 17:48 ` [PATCH 2/3] arm64: entry: sdei: save and restore PMR for pseudo-NMI Ada Couprie Diaz
2026-11-18  9:58   ` Vladimir Murzin
2026-11-18 15:43     ` Ada Couprie Diaz
2026-11-18 15:42   ` [PATCH v2 " Ada Couprie Diaz
2026-11-17 17:48 ` [PATCH 3/3] arm64: head: set __entry_task along with task setup Ada Couprie Diaz
2026-11-18 11:01   ` Vladimir Murzin
2026-11-18 15:30     ` Ada Couprie Diaz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ce350f9-4dc4-480f-8a53-07ef9586d49b@arm.com \
    --to=ada.coupriediaz@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dawei.li@linux.dev \
    --cc=dianders@chromium.org \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=peterz@infradead.org \
    --cc=ruanjinjie@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=thuth@redhat.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®