[PATCH v4 4/5] ARM: smp: Store current pointer in TPIDRURO register if available

Russell King (Oracle) linux at armlinux.org.uk
Mon Sep 13 06:52:45 PDT 2021


On Mon, Sep 13, 2021 at 02:52:46PM +0200, Ard Biesheuvel wrote:
> Hi Russell,
> 
> Thanks for taking a look.
> 
> However, the next patch drops the 'ldr ip, [r4, #TI_TASK]' I am adding
> here, so I won't be able to use this as-is.
> 
> I could just split the ldr/set_current sequence into two, and change
> the first one into a mov in the following patch, and move the
> set_current to right before where sp is updated.
> 
> I.e., in this patch
> 
> @@ -762,6 +764,8 @@ ENTRY(__switch_to)
>         add     r7, r7, #TSK_STACK_CANARY & ~IMM12_MASK
>         .endif
>         ldr     r7, [r7, #TSK_STACK_CANARY & IMM12_MASK]
> +#elif defined(CONFIG_CURRENT_POINTER_IN_TPIDRURO)
> +       ldr     r7, [r2, #TI_TASK]
>  #endif
>  #ifdef CONFIG_CPU_USE_DOMAINS
>         mcr     p15, 0, r6, c3, c0, 0           @ Set domain register
> @@ -776,6 +780,7 @@ ENTRY(__switch_to)
>  #endif
>   THUMB(        mov     ip, r4                     )
>         mov     r0, r5
> +       set_current r7
>   ARM(  ldmia   r4, {r4 - sl, fp, sp, pc}  )
>   THUMB(        ldmia   ip!, {r4 - sl, fp}         )
>   THUMB(        ldr     sp, [ip], #4               )
> 
> and in the next one
> 
> @@ -765,7 +765,7 @@ ENTRY(__switch_to)
>         .endif
>         ldr     r7, [r7, #TSK_STACK_CANARY & IMM12_MASK]
>  #elif defined(CONFIG_CURRENT_POINTER_IN_TPIDRURO)
> -       ldr     r7, [r2, #TI_TASK]
> +       mov     r7, r2                          @ Preserve 'next'
>  #endif
>  #ifdef CONFIG_CPU_USE_DOMAINS
>         mcr     p15, 0, r6, c3, c0, 0           @ Set domain register
> 
> Would that work for you?

Definitely does! Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list