[PATCH rcu 11/12] torture: Flush printk() buffers before powering off

From: Paul E. McKenney
Date: Mon Jun 20 2022 - 19:00:22 EST


The rcutorture test suite produces quite a bit of console output
at the end of a test. This means that the new printk() kthreads
are likely to be in the process of flushing output at the time of
the torture_shutdown() function's call to kernel_power_off().

This commit therefore invokes pr_flush(1000, true) to flush this
pending console output before invoking kernel_power_off().

Fixes: 8e274732115f ("printk: extend console_lock for per-console locking")
Cc: John Ogness <john.ogness@xxxxxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
---
kernel/torture.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/torture.c b/kernel/torture.c
index 789aeb0e1159c..6d7b282fbb5f8 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -651,6 +651,7 @@ static int torture_shutdown(void *arg)
VERBOSE_TOROUT_STRING("No torture_shutdown_hook(), skipping.");
if (ftrace_dump_at_shutdown)
rcu_ftrace_dump(DUMP_ALL);
+ pr_flush(1000, true);
kernel_power_off(); /* Shut down the system. */
return 0;
}
--
2.31.1.189.g2e36527f23