Blob Blame History Raw
From: Petr Mladek <pmladek@suse.com>
Subject: printk: Make sure to wake up printk kthread from irq work for pending output
Patch-mainline: Not yet, still discussed upstream
References: bnc#744692, bnc#789311, bsc#1174146

The variable printk_kthread_need_flush_console informs
printk_kthread about a pending job. We need to set it also
when the console handling is deferred from the irq_work
that is triggered from printk_deferred().

Otherwise, printk_kthread might miss the new message
when it appears after console_unlock() finishes and
the wake_up_process() is called before the kthread calls
schedule().

Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 kernel/printk/printk.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2829,6 +2829,8 @@ static void wake_up_klogd_work_func(stru
 
 	if (pending & PRINTK_PENDING_OUTPUT) {
 		if (printk_kthread) {
+			/* Offload printing to a schedulable context. */
+			printk_kthread_need_flush_console = true;
 			wake_up_process(printk_kthread);
 		} else {
 			/*