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.

ktest: Stop dropping console output during power-cycle reboot

The POWER_CYCLE fallback added to reboot() flushes monitor output at the
wrong time. In the untimed reboot path, flushing immediately after
start_monitor() can consume the first output from the new boot before
monitor() begins reading it. In the timed path, flushing after POWER_CYCLE
can eat the "Linux version" banner or REBOOT_SUCCESS_LINE from the new
kernel.

That makes ktest miss the boot it is waiting for and can trigger an
unnecessary second power cycle.

Start the monitor before POWER_CYCLE so the reference counting stays
balanced, but only flush when reboot() was asked to wait for a timed
reboot. Perform that flush before issuing POWER_CYCLE so it drains stale
output from the old kernel instead of consuming the next boot.

Cc: John Hawley <warthog9@eaglescrag.net>
Cc: Andrea Righi <arighi@nvidia.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Cc: Matthieu Baerts <matttbe@kernel.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Pedro Falcato <pfalcato@suse.de>
Link: https://patch.msgid.link/20260307-ktest-fixes-v1-6-565d412f4925@suse.com
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Ricardo B. Marlière and committed by
Steven Rostedt
eae247f6 fcfc2572

+6 -5
+6 -5
tools/testing/ktest/ktest.pl
··· 1499 1499 } 1500 1500 1501 1501 if ($powercycle) { 1502 - run_command "$power_cycle"; 1503 - 1504 1502 start_monitor; 1505 - # flush out current monitor 1506 - # May contain the reboot success line 1507 - wait_for_monitor 1; 1503 + if (defined($time)) { 1504 + # Flush stale console output from the old kernel before power-cycling. 1505 + wait_for_monitor 1; 1506 + } 1507 + 1508 + run_command "$power_cycle"; 1508 1509 1509 1510 } else { 1510 1511 # Make sure everything has been written to disk