From 85f0f0250a07f38849a6342c1f51e60aee328cb5 Mon Sep 17 00:00:00 2001
From: Steven Rostedt <rostedt@goodmis.org>
Date: Tue, 18 Dec 2018 14:30:10 -0500
Subject: [PATCH 425/518] printk: Do not disable preemption calling
 console_unlock() in PREEMPT_RT

A stable backport placed open coded preempt_disable() around console_unlock()
to prevent delays in output of printk() due to a task holding the console
lock being preempted. But most consoles are not PREEMPT_RT safe, thus
it needs to be preemptable when PREEMPT_RT is enabled.

Replace the open coded preempt_disable() with migrate_disable() which
is a preempt_disable() on non PREEMPT_RT, but just disables migration
on PREEMPT_RT, even though it doesn't really depend on that.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/printk/printk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 4eb2d11ef7df7..19dbf2820db0f 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1959,7 +1959,7 @@ asmlinkage int vprintk_emit(int facility, int level,
 		 * console_sem which would prevent anyone from printing to
 		 * console
 		 */
-		preempt_disable();
+		migrate_disable();
 		/*
 		 * Try to acquire and then immediately release the console
 		 * semaphore.  The release will print out buffers and wake up
@@ -1967,7 +1967,7 @@ asmlinkage int vprintk_emit(int facility, int level,
 		 */
 		if (may_trylock && console_trylock_spinning())
 			console_unlock();
-		preempt_enable();
+		migrate_enable();
 	}
 
 	return printed_len;
-- 
2.41.0

