summaryrefslogtreecommitdiffstats
path: root/printk-Restore-irqs-before-calling-release_console_m.patch
blob: 979785500b5adc72f5c5a50033189ad3d6aa6511 (plain)
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
From 0fd950ec150a0792f849261f13837315dda73f84 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 2 Aug 2010 16:25:37 +0200
Subject: [PATCH] printk: Restore irqs before calling release_console_mutex()

commit 8a990abe111ffa920f22d4ed04af1415c30d3c3a in tip.

Mike reported that printk is not working properly on RT. The reason is
that we call release_console_mutex() which calls the console drivers
with interrupts disabled, even if printk was called from an irq
enabled region.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 kernel/printk.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 9c5139c..013f0e5 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -790,9 +790,11 @@ asmlinkage int vprintk(const char *fmt, va_list args)
 	 * will release 'logbuf_lock' regardless of whether it
 	 * actually gets the mutex or not.
 	 */
-	if (acquire_console_mutex_for_printk(this_cpu))
+	if (acquire_console_mutex_for_printk(this_cpu)) {
+		raw_local_irq_restore(flags);
 		release_console_mutex();
-
+		raw_local_irq_save(flags);
+	}
 	lockdep_on();
 out:
 	raw_local_irq_restore(flags);
@@ -1062,7 +1064,7 @@ void release_console_mutex(void)
 		/*
 		 * on PREEMPT_RT, call console drivers with
 		 * interrupts enabled (if printk was called
-		 * with interrupts disabled):
+		 * with interrupts enabled):
 		 */
 #ifdef CONFIG_PREEMPT_RT
 		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
-- 
1.7.0.4