mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-31 22:47:12 +00:00
30 lines
959 B
Diff
30 lines
959 B
Diff
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
Date: Wed, 2 Dec 2015 11:34:07 +0100
|
|
Subject: [PATCH 16/22] locking/rtmutex: Allow rt_mutex_trylock() on PREEMPT_RT
|
|
|
|
Non PREEMPT_RT kernel can deadlock on rt_mutex_trylock() in softirq
|
|
context.
|
|
On PREEMPT_RT the softirq context is handled in thread context. This
|
|
avoids the deadlock in the slow path and PI-boosting will be done on the
|
|
correct thread.
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
---
|
|
kernel/locking/rtmutex.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
--- a/kernel/locking/rtmutex.c
|
|
+++ b/kernel/locking/rtmutex.c
|
|
@@ -1884,7 +1884,11 @@ int __sched __rt_mutex_futex_trylock(str
|
|
|
|
int __sched __rt_mutex_trylock(struct rt_mutex *lock)
|
|
{
|
|
+#ifdef CONFIG_PREEMPT_RT
|
|
+ if (WARN_ON_ONCE(in_irq() || in_nmi()))
|
|
+#else
|
|
if (WARN_ON_ONCE(in_irq() || in_nmi() || in_serving_softirq()))
|
|
+#endif
|
|
return 0;
|
|
|
|
return rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock);
|