Re: [RFT PATCH] ARM: vfp: Fix broken softirq handling with instrumentation enabled

From
Ard Biesheuvel <ardb@kernel.org>
Date
2023-03-14 13:59:57
Reply to
Frederic Weisbecker, 2023-03-14
On Tue, 14 Mar 2023 at 14:12, Frederic Weisbecker [off-list ref] wrote:
Le Tue, Mar 14, 2023 at 01:57:43PM +0100, Ard Biesheuvel a écrit :
quoted
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index 9a89264cdcc0b46e..9555c0a1c46fd47b 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -22,7 +22,23 @@
 @  IRQs enabled.
 @
 ENTRY(do_vfp)
-     local_bh_disable r10, r4
+#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_TRACE_IRQFLAGS)
+     mov     r4, r0                  @ stash r0, r2, lr
+     mov     r5, r2
+     mov     r6, lr
+
+     adr     r0, .
+     mov     r1, #SOFTIRQ_DISABLE_OFFSET
+     bl      __local_bh_disable_ip
+
+     mov     r0, r4                  @ restore r0, r2, lr
+     mov     r2, r5
+     mov     lr, r6
+#else
+     ldr     r4, [r10, #TI_PREEMPT]
+     add     r4, r4, #SOFTIRQ_DISABLE_OFFSET
+     str     r4, [r10, #TI_PREEMPT]
+#endi
I suggest you avoid taking any risk and unconditionally call
__local_bh_disable_ip(). You never know what will be added to softirq
APIs in the future.
That is not possible - __local_bh_disable_ip() is only a callable
function under the #ifdef condition, and a static inline otherwise.
For example you're missing the CONFIG_DEBUG_PREEMPT part.
Yeah, so I'd have to call preempt_count_add() directly from asm
instead - that should work, although it becomes a bit of a kludge now.
I'll try to find a solution that is a bit cleaner.

Thanks,
Ard.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (5 messages) 5 messages, 3 authors, last reply 2023-03-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help