]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ktest: Stop dropping console output during power-cycle reboot
authorRicardo B. Marlière <rbm@suse.com>
Sat, 7 Mar 2026 22:08:01 +0000 (19:08 -0300)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 9 Mar 2026 14:32:07 +0000 (10:32 -0400)
commiteae247f65dece5018c83d25d165ddecd45f93dfb
tree3d8da565a2cf577f8421fcb183a101f2a3d8a03b
parentfcfc25725a19e7e41f788380df82cab42226de5a
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>
tools/testing/ktest/ktest.pl