linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] printk: Skip console drivers on PREEMPT_RT.
@ 2022-07-20 15:48 Sebastian Andrzej Siewior
  2022-07-20 16:26 ` John Ogness
  0 siblings, 1 reply; 15+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-07-20 15:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, John Ogness,
	Thomas Gleixner

printk might be invoked in a context with disabled interrupts and or
preemption and additionally disables interrupts before it invokes the
console drivers. This is behaviour is not compatible with PREEMPT_RT.

Disable console printing until the return of atomic consoles and the
printing thread. This allows to retrieve the log buffer from user space
which is not possible by disable printk.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/printk/printk.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2843,6 +2843,16 @@ void console_unlock(void)
 	}
 
 	/*
+	 * On PREEMPT_RT it is not possible to invoke console drivers with
+	 * disabled interrupts and or preemption. Therefore all drivers are
+	 * skipped and the output can be retrieved from the buffer.
+	 */
+	if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
+		up_console_sem();
+		return;
+	}
+
+	/*
 	 * Console drivers are called with interrupts disabled, so
 	 * @console_may_schedule should be cleared before; however, we may
 	 * end up dumping a lot of lines, for example, if called from

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-07-26 13:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 15:48 [PATCH] printk: Skip console drivers on PREEMPT_RT Sebastian Andrzej Siewior
2022-07-20 16:26 ` John Ogness
2022-07-20 16:35   ` Sebastian Andrzej Siewior
2022-07-20 17:50     ` John Ogness
2022-07-21  6:50       ` [PATCH v2] " Sebastian Andrzej Siewior
2022-07-22 12:39         ` Petr Mladek
2022-07-22 17:03           ` Sebastian Andrzej Siewior
2022-07-25 12:30             ` Petr Mladek
2022-07-25 12:51               ` John Ogness
2022-07-25 13:55               ` Sebastian Andrzej Siewior
2022-07-25 14:24                 ` Petr Mladek
2022-07-25 15:16                   ` [PATCH v3] " Sebastian Andrzej Siewior
2022-07-26  7:39                     ` Petr Mladek
2022-07-26  7:57                     ` John Ogness
2022-07-26 13:11                       ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).