Thread (11 messages) 11 messages, 4 authors, 2021-11-30

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

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2021-11-30 08:04:13

On Fri, 26 Nov 2021 at 23:32, Arnd Bergmann [off-list ref] wrote:
On Fri, Nov 26, 2021 at 11:10 AM Ard Biesheuvel [off-list ref] wrote:
quoted
@@ -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.
quoted
 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.
OK
quoted
@@ -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.
Agreed.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help