From: Vladimir Murzin <vladimir.murzin@arm.com>
To: Ada Couprie Diaz <ada.coupriediaz@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 11:01:57 +0000 [thread overview]
Message-ID: <f232d0ff-3286-4d85-b9e3-cad8c6bc7178@arm.com> (raw)
In-Reply-To: <20261117174814.95936-4-ada.coupriediaz@arm.com>
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
> Set `__entry_task` as soon as we have a proper task set up in
> `init_cpu_task()` in case we get interrupted before switching threads.
>
> Remove the second paragraph of the comment on `__entry_task`, as it has
> been incorrect since the introduction of SDEI, and even more so
> with this change.
>
> Fixes: f5df26961853 ("arm64: kernel: Add arch-specific SDEI entry code and CPU masking")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
> ---
> arch/arm64/kernel/head.S | 3 +++
> arch/arm64/kernel/process.c | 3 ---
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index d6ba3c0af811..e53a9c6fec83 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -209,6 +209,9 @@ SYM_CODE_END(preserve_boot_args)
> ldr w\tmp2, [\tsk, #TSK_TI_CPU]
> ldr \tmp1, [\tmp1, \tmp2, lsl #3]
> set_this_cpu_offset \tmp1
> +
> + adr_l \tmp2, __entry_task
> + str \tsk, [\tmp2, \tmp1]
> .endm
>
> /*
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 42b15b0c069f..c3d194676efc 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -584,9 +584,6 @@ static void ssbs_thread_switch(struct task_struct *next)
> /*
> * We store our current task in sp_el0, which is clobbered by userspace. Keep a
> * shadow copy so that we can restore this upon entry from userspace.
> - *
> - * This is *only* for exception entry from EL0, and is not valid until we
> - * __switch_to() a user task.
> */
> DEFINE_PER_CPU(struct task_struct *, __entry_task);
>
> -- 2.43.0
>
prev parent reply other threads:[~2026-11-18 11:02 UTC|newest]
Thread overview: 6+ 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-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 [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=f232d0ff-3286-4d85-b9e3-cad8c6bc7178@arm.com \
--to=vladimir.murzin@arm.com \
--cc=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=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®