aboutsummaryrefslogtreecommitdiffstats
path: root/features/rt/locking-rtmutex-Allow-rt_mutex_trylock-on-PREEMPT_RT.patch
diff options
context:
space:
mode:
Diffstat (limited to 'features/rt/locking-rtmutex-Allow-rt_mutex_trylock-on-PREEMPT_RT.patch')
-rw-r--r--features/rt/locking-rtmutex-Allow-rt_mutex_trylock-on-PREEMPT_RT.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/features/rt/locking-rtmutex-Allow-rt_mutex_trylock-on-PREEMPT_RT.patch b/features/rt/locking-rtmutex-Allow-rt_mutex_trylock-on-PREEMPT_RT.patch
new file mode 100644
index 00000000..2e0997d6
--- /dev/null
+++ b/features/rt/locking-rtmutex-Allow-rt_mutex_trylock-on-PREEMPT_RT.patch
@@ -0,0 +1,36 @@
+From 50f8ea4c311b4bc5100595c2c43f02754afa2798 Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Wed, 2 Dec 2015 11:34:07 +0100
+Subject: [PATCH 076/191] 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(+)
+
+diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
+index 03ffb955b286..f0bc7fcae441 100644
+--- a/kernel/locking/rtmutex.c
++++ b/kernel/locking/rtmutex.c
+@@ -1866,7 +1866,11 @@ int __sched __rt_mutex_futex_trylock(struct rt_mutex *lock)
+
+ 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);
+--
+2.19.1
+