lkml.org 
[lkml]   [2019]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH RT] printk: Shortcut out of waiter spinning on PREEMPT_RT
From: Steven Rostedt (VMware) <rostedt@goodmis.org>

As the consoles are written with preemption enabled in PREEMPT_RT, we
must not have any task spinning waiting on them. Currently, the code
that would make the task spin is #ifdef out when PREEMPT_RT is
enabled, but why go through grabbing of the locks to see if an owner is
set, when it never will be?

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a43d07d4e043..1a61132deec1 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1742,6 +1742,13 @@ static int console_trylock_spinning(void)
if (console_trylock())
return 1;

+ /*
+ * The consoles are preemptable in PREEMPT_RT, which can cause
+ * spinning to deadlock.
+ */
+ if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
+ return 0;
+
printk_safe_enter_irqsave(flags);

raw_spin_lock(&console_owner_lock);
\
 
 \ /
  Last update: 2019-01-15 18:40    [W:0.064 / U:2.564 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site