Re: [PATCH 3/3] arm64: head: set __entry_task along with task setup
From: Ada Couprie Diaz
Date: Wed Nov 18 2026 - 10:30:23 EST
[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()`, despiteTBH I do not know much about SDEI, but don't we need opt-in for
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.
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