From nobody Tue Apr 7 04:18:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD9AD3E022D for ; Mon, 16 Mar 2026 18:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773686452; cv=none; b=tiNk2VcXYs4v+2gyxIWkkBL9a6vA8cHZ8AQWbTrAYO+ax4fPDJ05req80XsGoUZV1KMsDtsNJQE7JTam/7bPmG31lxWc0XArRWwXvyGGaxnbqCwH6Dg8+LjCXT0bcaAb3xqJySLD2GouZSp5U74/hQ5NxOOiAEyp0WbStzQHi/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773686452; c=relaxed/simple; bh=UFuVlewfajqwppv+1GGRpSZagwtIXopeyq/TTvgiuRQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=tHjGcQ9kPnciFh6HL8NIuOYvzj+3XXSFOavSXWX2OG2SW9e+Dx4g+Q/srmO8ulfN7dTBvy04hZ53un03hnKEDKf0uX/KF7rpsT9yal/LTB+ijo0m+SkPwNucgPOxzfKCwGbObBZmavz422DYZJshtoV988b43zf3rMlYliOSxe0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k8KhMir9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k8KhMir9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63EEBC2BCB7; Mon, 16 Mar 2026 18:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773686452; bh=UFuVlewfajqwppv+1GGRpSZagwtIXopeyq/TTvgiuRQ=; h=Date:From:To:Cc:Subject:References:From; b=k8KhMir9sFAheHWy2tLq9PNmQa3nU418MD7pQ+CBJzRAKCRz74x1hW5SF0p7lHwge x7hGl7+A/O8Z5iIBiOE5hhEbowJNITpfgfwgcKPuyW5092GsyyCvV5wpCfbFLIz656 HUhhhT48cRKHOoRadvZnhhD9oHFv5ioj6L2PUybc5MpRAVgpJEJSdbc5oKSxVZfyvB O4y013UIqTbgQlPPyU7cz8FdytQvtQ40vlzqSTh1n87dRJQ9GABcIVkt6RUQpYUcp7 QdL+x9whsSEutHA4mrwWK+s0kkeBYHgCmVXZEHyz8XAjYSlOx9tIEXJtvDqfi8wqtX TBXHDycgJe0gA== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1w2CsO-0000000854P-2qEf; Mon, 16 Mar 2026 14:41:16 -0400 Message-ID: <20260316184116.554314614@kernel.org> User-Agent: quilt/0.69 Date: Mon, 16 Mar 2026 14:40:39 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: "John Warthog9 Hawley" , =?UTF-8?q?Ricardo=20B.=20Marli=C3=A8re?= , John Hawley , Andrea Righi , Marcos Paulo de Souza , Matthieu Baerts , Fernando Fernandez Mancera , Pedro Falcato Subject: [for-next][PATCH 6/9] ktest: Stop dropping console output during power-cycle reboot References: <20260316184033.927944169@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: =3D?UTF-8?q?Ricardo=3D20B=3D2E=3D20Marli=3DC3=3DA8re?=3D 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 Cc: Andrea Righi Cc: Marcos Paulo de Souza Cc: Matthieu Baerts Cc: Fernando Fernandez Mancera Cc: Pedro Falcato Link: https://patch.msgid.link/20260307-ktest-fixes-v1-6-565d412f4925@suse.= com Signed-off-by: Ricardo B. Marli=C3=A8re Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 9d6f50045dbd..bd2e2311884c 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -1499,12 +1499,13 @@ sub reboot { } =20 if ($powercycle) { - run_command "$power_cycle"; - start_monitor; - # flush out current monitor - # May contain the reboot success line - wait_for_monitor 1; + if (defined($time)) { + # Flush stale console output from the old kernel before power-cycling. + wait_for_monitor 1; + } + + run_command "$power_cycle"; =20 } else { # Make sure everything has been written to disk --=20 2.51.0