2012-06-17 19:52:06 +00:00
|
|
|
From 00229616325e03e182a5f2388f06de820ec78c67 Mon Sep 17 00:00:00 2001
|
2011-11-20 00:01:55 +00:00
|
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
|
|
Date: Sun, 17 Jul 2011 22:43:07 +0200
|
2012-06-17 19:52:06 +00:00
|
|
|
Subject: [216/254] console-make-rt-friendly.patch
|
2011-11-20 00:01:55 +00:00
|
|
|
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
|
|
---
|
|
|
|
kernel/printk.c | 26 +++++++++++++++++++++++---
|
|
|
|
1 file changed, 23 insertions(+), 3 deletions(-)
|
|
|
|
|
2012-06-17 19:52:06 +00:00
|
|
|
diff --git a/kernel/printk.c b/kernel/printk.c
|
|
|
|
index 9a27a94..28baa36 100644
|
|
|
|
--- a/kernel/printk.c
|
|
|
|
+++ b/kernel/printk.c
|
|
|
|
@@ -507,6 +507,7 @@ static void __call_console_drivers(unsigned start, unsigned end)
|
2011-11-20 00:01:55 +00:00
|
|
|
{
|
|
|
|
struct console *con;
|
|
|
|
|
|
|
|
+ migrate_disable();
|
|
|
|
for_each_console(con) {
|
|
|
|
if (exclusive_console && con != exclusive_console)
|
|
|
|
continue;
|
2012-06-17 19:52:06 +00:00
|
|
|
@@ -515,6 +516,7 @@ static void __call_console_drivers(unsigned start, unsigned end)
|
2011-11-20 00:01:55 +00:00
|
|
|
(con->flags & CON_ANYTIME)))
|
|
|
|
con->write(con, &LOG_BUF(start), end - start);
|
|
|
|
}
|
|
|
|
+ migrate_enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_EARLY_PRINTK
|
2012-06-17 19:52:06 +00:00
|
|
|
@@ -839,12 +841,18 @@ static inline int can_use_console(unsigned int cpu)
|
2011-11-20 00:01:55 +00:00
|
|
|
* interrupts disabled. It should return with 'lockbuf_lock'
|
|
|
|
* released but interrupts still disabled.
|
|
|
|
*/
|
|
|
|
-static int console_trylock_for_printk(unsigned int cpu)
|
|
|
|
+static int console_trylock_for_printk(unsigned int cpu, unsigned long flags)
|
|
|
|
__releases(&logbuf_lock)
|
|
|
|
{
|
|
|
|
int retval = 0, wake = 0;
|
|
|
|
+#ifdef CONFIG_PREEMPT_RT_FULL
|
|
|
|
+ int lock = !early_boot_irqs_disabled && !irqs_disabled_flags(flags) &&
|
|
|
|
+ !preempt_count();
|
|
|
|
+#else
|
|
|
|
+ int lock = 1;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- if (console_trylock()) {
|
|
|
|
+ if (lock && console_trylock()) {
|
|
|
|
retval = 1;
|
|
|
|
|
|
|
|
/*
|
2012-06-17 19:52:06 +00:00
|
|
|
@@ -1021,8 +1029,15 @@ asmlinkage int vprintk(const char *fmt, va_list args)
|
2011-11-20 00:01:55 +00:00
|
|
|
* will release 'logbuf_lock' regardless of whether it
|
|
|
|
* actually gets the semaphore or not.
|
|
|
|
*/
|
|
|
|
- if (console_trylock_for_printk(this_cpu))
|
|
|
|
+ if (console_trylock_for_printk(this_cpu, flags)) {
|
|
|
|
+#ifndef CONFIG_PREEMPT_RT_FULL
|
|
|
|
console_unlock();
|
|
|
|
+#else
|
|
|
|
+ raw_local_irq_restore(flags);
|
|
|
|
+ console_unlock();
|
|
|
|
+ raw_local_irq_save(flags);
|
|
|
|
+#endif
|
|
|
|
+ }
|
|
|
|
|
|
|
|
lockdep_on();
|
|
|
|
out_restore_irqs:
|
2012-06-04 21:20:09 +00:00
|
|
|
@@ -1345,11 +1360,16 @@ again:
|
2011-11-20 00:01:55 +00:00
|
|
|
_con_start = con_start;
|
|
|
|
_log_end = log_end;
|
|
|
|
con_start = log_end; /* Flush */
|
|
|
|
+#ifndef CONFIG_PREEMPT_RT_FULL
|
|
|
|
raw_spin_unlock(&logbuf_lock);
|
|
|
|
stop_critical_timings(); /* don't trace print latency */
|
|
|
|
call_console_drivers(_con_start, _log_end);
|
|
|
|
start_critical_timings();
|
|
|
|
local_irq_restore(flags);
|
|
|
|
+#else
|
|
|
|
+ raw_spin_unlock_irqrestore(&logbuf_lock, flags);
|
|
|
|
+ call_console_drivers(_con_start, _log_end);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
console_locked = 0;
|
|
|
|
|