[RFC PATCH 6/6] ARM: implement THREAD_INFO_IN_TASK for uniprocessor systems

Arnd Bergmann arnd at arndb.de
Fri Nov 26 14:32:10 PST 2021


On Fri, Nov 26, 2021 at 11:10 AM Ard Biesheuvel <ardb at kernel.org> wrote:
> @@ -1169,7 +1169,7 @@ config CURRENT_POINTER_IN_TPIDRURO
>
>  config IRQSTACKS
>         def_bool y
> -       depends on GENERIC_IRQ_MULTI_HANDLER && THREAD_INFO_IN_TASK
> +       depends on GENERIC_IRQ_MULTI_HANDLER
>         select HAVE_IRQ_EXIT_ON_IRQ_STACK
>         select HAVE_SOFTIRQ_ON_OWN_STACK

Side note: after this, we might want to investigate finishing off
GENERIC_IRQ_MULTI_HANDLER for all architectures. The
currently missing platforms are ARM_SINGLE_ARMV7M,
ARCH_FOOTBRIDGE, ARCH_IOP32X and ARCH_RPC.

These are a bit tricky (presumably this is why they are not converted
yet), but it should be possible to do.

>  static inline void set_current(struct task_struct *cur)
>  {
> -       if (!IS_ENABLED(CONFIG_CURRENT_POINTER_IN_TPIDRURO))
> +       if (!IS_ENABLED(CONFIG_CURRENT_POINTER_IN_TPIDRURO) &&
> +           !(IS_ENABLED(CONFIG_SMP) &&
> +             IS_ENABLED(CONFIG_SMP_ON_UP) &&
> +             smp_on_up)) {

I think you can just use is_smp() here to simplify the condition. You might
need to move the definition to a different header if that causes an #include
loop.

> @@ -39,16 +67,30 @@ static inline struct task_struct *get_current(void)
>          * https://github.com/ClangBuiltLinux/linux/issues/1485
>          */
>         cur = __builtin_thread_pointer();
> +#elif defined(CONFIG_CURRENT_POINTER_IN_TPIDRURO) || defined(CONFIG_SMP)
> +       asm("0: mrc p15, 0, %0, c13, c0, 3                      \n\t"
> +#ifdef CONFIG_CPU_V6
> +           "1:                                                 \n\t"
> +           "   .subsection 1                                   \n\t"
> +           "2: " LOAD_CURRENT
> +           "   b       1b                                      \n\t"
> +           "   .previous                                       \n\t"
> +           "   .pushsection \".alt.smp.init\", \"a\"           \n\t"
> +           "   .long   0b - .                                  \n\t"
> +           "   b       . + (2b - 0b)                           \n\t"
> +           "   .popsection                                     \n\t"
> +#endif

You mentioned earlier that this gets ugly with SMP_ON_UP on ARMv6, now
I see what you meant ;-)

I can see an increasing number of reasons for no longer supporting this
option. As we recently discussed on IRC, this would affect omap2plus_defconfig,
imx_v6_v7_defconfig and realview_defconfig, which would all have to drop
either CPU_V6 or SMP. Since you got it working already, this also seems
better left as a cleanup for another time once we can build consensus on it,
but my guess is that at this point the benefits of removing it outweigh those
of keeping it.

        Arnd



More information about the linux-arm-kernel mailing list