Re: [PATCH v2 1/7] arm64: add CPU field to struct thread_info
From: Ard Biesheuvel
Date: Thu Sep 30 2021 - 09:08:40 EST
On Thu, 30 Sept 2021 at 15:06, Christophe Leroy
<christophe.leroy@xxxxxxxxxx> wrote:
>
>
>
> Le 30/09/2021 à 14:58, Ard Biesheuvel a écrit :
> > The CPU field will be moved back into thread_info even when
> > THREAD_INFO_IN_TASK is enabled, so add it back to arm64's definition of
> > struct thread_info.
> >
> > Note that arm64 always has CONFIG_SMP=y so there is no point in guarding
> > the CPU field with an #ifdef.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> > Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>
> > Acked-by: Mark Rutland <mark.rutland@xxxxxxx>
> > ---
> > arch/arm64/include/asm/thread_info.h | 1 +
> > arch/arm64/kernel/asm-offsets.c | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
> > index 6623c99f0984..c02bc8c183c3 100644
> > --- a/arch/arm64/include/asm/thread_info.h
> > +++ b/arch/arm64/include/asm/thread_info.h
> > @@ -42,6 +42,7 @@ struct thread_info {
> > void *scs_base;
> > void *scs_sp;
> > #endif
> > + u32 cpu;
> > };
> >
> > #define thread_saved_pc(tsk) \
> > diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> > index 551427ae8cc5..cee9f3e9f906 100644
> > --- a/arch/arm64/kernel/asm-offsets.c
> > +++ b/arch/arm64/kernel/asm-offsets.c
> > @@ -29,6 +29,7 @@ int main(void)
> > DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
> > DEFINE(TSK_CPU, offsetof(struct task_struct, cpu));
> > BLANK();
> > + DEFINE(TSK_TI_CPU, offsetof(struct task_struct, thread_info.cpu));
>
> Why adding that now ? For powerpc you do the switch in 5.
>
Why not?
> > DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags));
> > DEFINE(TSK_TI_PREEMPT, offsetof(struct task_struct, thread_info.preempt_count));
> > #ifdef CONFIG_ARM64_SW_TTBR0_PAN
> >