2018-08-27 14:32:32 +00:00
|
|
|
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
2019-04-08 23:49:20 +00:00
|
|
|
Date: Wed, 2 Dec 2015 11:34:07 +0100
|
2019-11-25 00:04:39 +00:00
|
|
|
Subject: [PATCH 128/290] rtmutex: trylock is okay on -RT
|
|
|
|
Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6844789b0db950fc38370175d40fd017331e8fb7
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
non-RT kernel could deadlock on rt_mutex_trylock() in softirq context. On
|
|
|
|
-RT we don't run softirqs in IRQ context but in thread context so it is
|
|
|
|
not a issue here.
|
|
|
|
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
kernel/locking/rtmutex.c | 4 ++++
|
2018-08-27 14:32:32 +00:00
|
|
|
1 file changed, 4 insertions(+)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
|
|
|
|
index 9562aaa2afdc..72abe7c121fa 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/kernel/locking/rtmutex.c
|
|
|
|
+++ b/kernel/locking/rtmutex.c
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -1583,7 +1583,11 @@ int __sched rt_mutex_trylock(struct rt_mutex *lock)
|
2018-08-27 14:32:32 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PREEMPT_RT_FULL
|
|
|
|
+ if (WARN_ON_ONCE(in_irq() || in_nmi()))
|
|
|
|
+#else
|
|
|
|
if (WARN_ON_ONCE(in_irq() || in_nmi() || in_serving_softirq()))
|
|
|
|
+#endif
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ret = rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock);
|