]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0113-rtmutex-trylock-is-okay-on-RT.patch
rt_patches: required rebase due to printk change
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0113-rtmutex-trylock-is-okay-on-RT.patch
1 From a5dd12f982f6e5fbfd1b09356407bf078dd63f95 Mon Sep 17 00:00:00 2001
2 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
3 Date: Wed, 2 Dec 2015 11:34:07 +0100
4 Subject: [PATCH 113/366] rtmutex: trylock is okay on -RT
5
6 non-RT kernel could deadlock on rt_mutex_trylock() in softirq context. On
7 -RT we don't run softirqs in IRQ context but in thread context so it is
8 not a issue here.
9
10 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
11 ---
12  kernel/locking/rtmutex.c | 4 ++++
13  1 file changed, 4 insertions(+)
14
15 diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
16 index 397bd9e..01f4dc1 100644
17 --- a/kernel/locking/rtmutex.c
18 +++ b/kernel/locking/rtmutex.c
19 @@ -1469,7 +1469,11 @@ EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
20   */
21  int __sched rt_mutex_trylock(struct rt_mutex *lock)
22  {
23 +#ifdef CONFIG_PREEMPT_RT_FULL
24 +       if (WARN_ON(in_irq() || in_nmi()))
25 +#else
26         if (WARN_ON(in_irq() || in_nmi() || in_serving_softirq()))
27 +#endif
28                 return 0;
29  
30         return rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock);
31 -- 
32 1.9.1
33