| From b216e3f5d23abb650960b3ea02e826f456d28d92 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> |
| |
| 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.1.1 |
| |