Re: [PATCH v2 01/21] arm64: entry: Defer setting of TPIDRRO_EL0 until exit to userspace
From: Linus Walleij
Date: Wed Sep 30 2026 - 17:57:16 EST
Hi Will,
long time before I had a chance to look at this.
I wrote a similar patch at one time so I like the concept.
On Fri, Sep 18, 2026 at 6:14 PM Will Deacon <will@xxxxxxxxxx> wrote:
> In preparation for using TPIDRRO_EL0 to point at 'current' while running
> inside the kernel, defer its userspace initialisation from the
> context-switch patch to exception return. This has the added benefit of
> not having to worry about keeping the in-memory value and the register
> value in-sync during preemptible sections.
>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Reviewed-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
> Signed-off-by: Will Deacon <will@xxxxxxxxxx>
I would add some elaboration to the commit message as to what is going
on in the patch, and correct me if I got it wrong!
- Userspace sees 0 in the TPIDRRO_EL0 when running native tasks
so we just zero it when exiting to userspace for those.
- For compat mode, TPIDRRO_EL0 should contain
current->thread.uw.tp_value, so in that case we just write that
before exiting to userspace.
- Userspace can't modify the register so we don't care about
saving it on entry.
These three seems to be what the patch is exploiting.
If this is correct, with the above description added:
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij