1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
From b98cd0f242b81152b147c327165e0ae013107309 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 3 Jul 2009 08:44:13 -0500
Subject: [PATCH] printk: dont bug on sched
commit 537b86b6c059b7b0a46979cc144134050d1da511 in tip.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
kernel/rtmutex.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index dfbae19..ec2273b 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/timer.h>
+#include <linux/hardirq.h>
#include <linux/semaphore.h>
#include "rtmutex_common.h"
@@ -679,8 +680,11 @@ rt_spin_lock_fastlock(struct rt_mutex *lock,
void (*slowfn)(struct rt_mutex *lock))
{
/* Temporary HACK! */
- if (!current->in_printk)
+ if (likely(!current->in_printk))
might_sleep();
+ else if (in_atomic() || irqs_disabled())
+ /* don't grab locks for printk in atomic */
+ return;
if (likely(rt_mutex_cmpxchg(lock, NULL, current)))
rt_mutex_deadlock_account_lock(lock, current);
@@ -692,6 +696,11 @@ static inline void
rt_spin_lock_fastunlock(struct rt_mutex *lock,
void (*slowfn)(struct rt_mutex *lock))
{
+ /* Temporary HACK! */
+ if (unlikely(rt_mutex_owner(lock) != current) && current->in_printk)
+ /* don't grab locks for printk in atomic */
+ return;
+
if (likely(rt_mutex_cmpxchg(lock, current, NULL)))
rt_mutex_deadlock_account_unlock(current);
else
--
1.7.0.4
|