From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796326746; b=HPdnmWnf/68UjSIeUYPtfNlPCSTFGi+IDsGcnWC1bAv/W7a726pe1gQ7biX6EaNcc1ba 4OHSEYCxYt+9FwUX6O3g5lskW6OXtGuSONjrY3neDThnS9kQ4sUjZ+KhpkwimM9xNtSJi v7ZhD0yDG/AgAQ+n5b1GpUZrZ0vNyhDTbWq/bLIQnIw6GdYYy6/J3Vc2ulXWMcPZioAFr nh8nBYI95QAHUJrBRXLIkMWLhCNrM0v4NjvfGKsBLFTEBwg7u5MhOKlrX8sLSXlAdDW5j X60WtNvidD2lC+2dHr6ThqUA4NdiCDhznGyPtoYe7c4YVLi2iudj+92PJ4O0MTHF2FQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796326746; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=70nuIJ4Nv5qwvQi+yfJyf1l9kEhCnZThr9upKpRPCSU=; b=3ia3SVjU/NDENhuhEcCsg4E1yKlaPdp0ElN1IMKEfKrQwuQ9btDuWLM4OCApqyU+t+vL cb2lN/nsROq5Ds2YFE7UWdZhmO9tJklhfN3lHeVLkkpv2P5+k9C8pYca8WkxgZfA/MzIO noeHtPPhq6UjeEeHnczBuYRKimjLZxr+dTT8QCgV9q1D40oZvPDuxTex0iq7io1W2H7bF r3Y/hB4jt0V+raefEHOce0SgoTj/bQyylJWUybl5o7v2viOB5AdwZbGu4TfTCEx5GpUhb AEyVSEf+Dt6YW6ZAi5N3gbLvmWC8B/Hl5sZNpm2xMXl+p3IyLOgdhP8lMRpaNtjNmpA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="C0TGa/zQ"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69A2D60A382B for ; Thu, 3 Dec 2026 19:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=C0TGa/zQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 325BA1F00A06; Thu, 3 Dec 2026 19:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796326746; bh=70nuIJ4Nv5qwvQi+yfJyf1l9kEhCnZThr9upKpRPCSU=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=C0TGa/zQTqW8uGKMGHBdh//cPtLpdDQjbJpF/IMe2pD/QMv8Rs8UgCRg6Qq75k2MU 2Nn4RsQSnAGKgoGNjwhlVJfg7G6SqdW083ILtS1otE6zgq2svtkbbxMONEzJG2UhcA r7RnHIW6pLiRfAQUXjjGO8bANdUJ6fLWgjjR9vb7z7lNwrqDY5CWzrvDxll3D+y7Hg A73oS3AUCafuH6antx+LhZXca0uNpXm3FA4kwucefNpx+8gkht7QJU+fPjTh7RzH6T UL4EY+kDtJYbXxM1c3i8wkBdBf8HC5hizm5/Dii85LsEwwW+h7M7ICoVm1tPMNiqct B8NenDlU1QIaQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v10 09/19] tracing/remotes: selftests: Add a test for the dmesg tracefs file Reply-To: sashiko-reviews@lists.linux.dev To: "Vincent Donnefort" , linux-trace-kernel@vger.kernel.org In-Reply-To: <20261203190007.2431041-10-vdonnefort@google.com> References: <20261203190007.2431041-1-vdonnefort@google.com> <20261203190007.2431041-10-vdonnefort@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 19:39:05 +0000 X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] tracing/remotes: selftests: brittle last_ts extraction in test_dmesg() - [Low] tracing/remotes: selftests: missing EXIT trap in test_dmesg() - [Low] tracing/remotes: dmesg.tc requires prevents setup_remote_test() modprobe -- commit bc9cb076ab5e60b7619de93702cc7920401a88b8 Author: Vincent Donnefort tracing/remotes: selftests: Add a test for the dmesg tracefs file This commit adds ftrace selftests for the trace remote dmesg redirection tracefs file on both the test and hypervisor remotes, and resets the dmesg file in setup_remote(). > diff --git a/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc b/too= ls/testing/selftests/ftrace/test.d/remotes/dmesg.tc > new file mode 100644 > index 0000000000000..f667b14556b6a > --- /dev/null > +++ b/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc > @@ -0,0 +1,91 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > +# description: Test trace remote dmesg redirection > +# requires: remotes/test remotes/test/dmesg [Severity: Low] Does this requires line prevent setup_remote_test() from loading remote_test.ko on demand? ftracetest runs check_requires() before sourcing the test script, so when CONFIG_TRACE_REMOTE_TEST=3Dm and remote_test.ko is not already loaded, check_requires() exits via exit_unsupported before setup_remote_test() can run modprobe remote_test. Removing the module-created paths from requires, having setup_remote_test() exit via exit_unsupported when remote_test is unavailable, and checking for dmesg after loading the module would allow the test to run with a modular build. [ ... ] > + # > + # Test dmesg on/off when tracing is disabled > + # > + echo 1 > dmesg > + test $(cat dmesg) -eq 1 > + assert_loaded > + > + echo 0 > dmesg > + test $(cat dmesg) -eq 0 > + assert_unloaded [Severity: Low] Can an early failure in test_dmesg() leave dmesg redirection enabled? Because test_dmesg() runs under set -e and finish_system() does not reset remotes/*/dmesg, any failing check while dmesg is 1 skips echo 0 > dmesg. That leaves the remote buffer pinned loaded and remote->poll_work rescheduling indefinitely. Adding an exit trap to write 0 to dmesg (as in remotes/hotplug.tc) would ensure cleanup on failure paths. [ ... ] > + # Timestamp format is '[ XXXX.YYYY]' > + last_ts=3D$(dmesg | tail -1 | sed -n 's/^\[ *\([0-9]*.[0-9]*\)\].*/\= 1/p') > + if [ -z "$last_ts" ]; then > + last_ts=3D0 > + fi > + > + # Emit events from the same CPU > + for cpu in $(get_cpu_ids); do > + break > + done > + > + nr_events=3D128 > + for i in $(seq 1 $nr_events); do > + taskset -c $cpu echo $i > write_event > + done > + > + sleep 1 > + output=3D$(mktemp $TMPDIR/remote_test.XXXXXX) > + dmesg | awk -v ts=3D$last_ts ' > + /^\[ *[0-9]+\.[0-9]+\]/ { > + t=3D$0; sub(/^[[ \t]*/, "", t); sub(/].*/, "", t); > + if (t+0 > ts+0) print $0 > + }' | grep "selftest id=3D" | sed 's/^.*\(\[[0-9]*\]\s*[0-9]*\.[0-9]*= : \)/\1/' > $output [Severity: Low] Is this last_ts extraction reliable if the last dmesg line has no timestamp? Because tail -1 runs before sed, a trailing continuation line without a bracketed timestamp leaves last_ts empty and falls back to 0. awk then includes older selftest id=3D lines from prior runs, causing check_trace to fail on duplicate sequences. The sed pattern also uses an unescaped dot and * quantifiers, so bracketed text with spaces or non-digits can match and break the unquoted -v ts=3D$last_ts in awk or evaluate ts+0 to 0. Running a strict sed regex bef= ore tail -1 and quoting "$last_ts" avoids both issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203190007.2431= 041-1-vdonnefort@google.com?part=3D9