Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Flush console log from kernel_power_off()

Kernels built with CONFIG_PREEMPT_RT=y can lose significant console output
and shutdown time, which hides shutdown-time RCU issues from rcutorture.
Therefore, make pr_flush() public and invoke it after then last print
in kernel_power_off().

[ paulmck: Apply John Ogness feedback. ]
[ paulmck: Appy Sebastian Andrzej Siewior feedback. ]
[ paulmck: Apply kernel test robot feedback. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Link: https://lore.kernel.org/r/5f743488-dc2a-4f19-bdda-cf50b9314832@paulmck-laptop
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>

authored by

Paul E. McKenney and committed by
Boqun Feng
6ea9a178 59bed79f

+8 -3
+6
include/linux/printk.h
··· 207 207 extern bool nbcon_device_try_acquire(struct console *con); 208 208 extern void nbcon_device_release(struct console *con); 209 209 void nbcon_atomic_flush_unsafe(void); 210 + bool pr_flush(int timeout_ms, bool reset_on_progress); 210 211 #else 211 212 static inline __printf(1, 0) 212 213 int vprintk(const char *s, va_list args) ··· 314 313 315 314 static inline void nbcon_atomic_flush_unsafe(void) 316 315 { 316 + } 317 + 318 + static inline bool pr_flush(int timeout_ms, bool reset_on_progress) 319 + { 320 + return true; 317 321 } 318 322 319 323 #endif
+1 -3
kernel/printk/printk.c
··· 2461 2461 } 2462 2462 EXPORT_SYMBOL(_printk); 2463 2463 2464 - static bool pr_flush(int timeout_ms, bool reset_on_progress); 2465 2464 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress); 2466 2465 2467 2466 #else /* CONFIG_PRINTK */ ··· 2473 2474 2474 2475 static u64 syslog_seq; 2475 2476 2476 - static bool pr_flush(int timeout_ms, bool reset_on_progress) { return true; } 2477 2477 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) { return true; } 2478 2478 2479 2479 #endif /* CONFIG_PRINTK */ ··· 4464 4466 * Context: Process context. May sleep while acquiring console lock. 4465 4467 * Return: true if all usable printers are caught up. 4466 4468 */ 4467 - static bool pr_flush(int timeout_ms, bool reset_on_progress) 4469 + bool pr_flush(int timeout_ms, bool reset_on_progress) 4468 4470 { 4469 4471 return __pr_flush(NULL, timeout_ms, reset_on_progress); 4470 4472 }
+1
kernel/reboot.c
··· 704 704 migrate_to_reboot_cpu(); 705 705 syscore_shutdown(); 706 706 pr_emerg("Power down\n"); 707 + pr_flush(1000, true); 707 708 kmsg_dump(KMSG_DUMP_SHUTDOWN); 708 709 machine_power_off(); 709 710 }