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=1796301427; b=BvfKe2JqJd/LnG89CqMKwv9nxJVzkNVpGIEhGD2IFDfSDOH9U3d5bUUM105KUIGo55zZ 5q5tpJSOOI3pBYPq2wR+Q94H761idmM6jAg6WUf2sA7JsRHW8EKFqBaX9OanHSaBil4ge 15E+buwJjaxevgcXu6Jw4h7jPPxwya2RUTkStWAhtVPlCLlDzFCMKp2Heb2NIMIsXTVpw A+V/nFDwbLLvpqZ8bwlfYiGyB0MBaNksZgqrklKEsDY8FdQj2f1+W6xLix/3ICNkveVBe ggMrJvUUNrfKzEH196C8Eamu9FqpBGgLC9zunHbzHit5ywuVgYbd3hXkUmQNMxZjviQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796301427; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=NWhPvvXt0pBIEtrAQFB2icN5k4sO5qb0DgW3MNawGr4=; b=HyaSkdOlRun/AtxamNdcXNjr0IHND7NTdB3TwDIalNT13dCMNvZDWJsQUHRrlf18l4mH haeqjJFQX9hlrw/50+vnAygWU3wN2aU39fuzOzjpjRiqc+ANK5rSEWT1n4Fev2Lfb7uTg dQbSpsW9JBN5Lb8XuXIyZAzXkCRv/dvJFc8+kdbAAYiAfJa+vIQiFMdIJobax/SubfOqJ rSNqwXWT2VjFEe22dRI+UihptxuPN6EkInnsEHrk4eD5QbFIGUeLSHbpzd+czxn5GSb2/ weDgToR5yA/glKfNhTtxKdEES49hLK7VPtsTcHnCMKlk1qN9vNF8XwRuDdXP6Dny0+w== 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=FxRd0way; 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 43982606A335 for ; Thu, 3 Dec 2026 12:37:07 +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=FxRd0way Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7A1F1F000C1; Thu, 3 Dec 2026 12:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796301427; bh=NWhPvvXt0pBIEtrAQFB2icN5k4sO5qb0DgW3MNawGr4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FxRd0waykO+GUaobwz6Vrie55KwQki9mLYGaRwerpgKGwsuiyM2J+DtcYP15Zl6Hw 6h8tlJjcq4+PCIipArfYBZl49MR7jzTiCqWwB/GojAsbzyNp6lMQyLzBOQwpxWvNFW 3TfjZ8uM/kBhwCfnjF8scYupnoaXz9K09T4N+Baijfuap5rGRoQX+5OuSxX91n4dEF t0voNTEhNX3hEutB/aznF6gMV5RACKtKMv506ZwmYlhD0OJvs9Kxc/gBCMymMdYmUg HIdzL1/KtMEPW7a09kiXRbX5H2wmF4knYhj8YwTYmiCxJOjbYiM6XFyBqoBmywbLBW mVqb0KMw6MGig== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 2/2] selftests: net: can: add vcan concurrent tx/stats test Reply-To: sashiko-reviews@lists.linux.dev To: "T S Rameshkumar" Cc: linux-can@vger.kernel.org, "Marc Kleine-Budde" , "Oliver Hartkopp" , "Vincent Mailhol" , "Oleksij Rempel" In-Reply-To: <20261203120559.421646-2-rameshsv06@gmail.com> References: <20261203111103.379929-1-rameshsv06@gmail.com> <20261203120559.421646-1-rameshsv06@gmail.com> <20261203120559.421646-2-rameshsv06@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 12:37:06 +0000 X-Mailing-List: linux-can@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: - [Medium] selftests: net: can: CAN_RAW SKIP() in test_vcan_stats.c reported as PASS - [Medium] selftests: net: can: raw RET=3D$rc in test_vcan_stats.sh masks failures as PASS - [Medium] selftests: net: can: barrier race in stats_reader() causes zero reader_reads -- commit f4c5f107871d0554eacce5fe33a073ddcc6bb5a8 Author: T S Rameshkumar selftests: net: can: add vcan concurrent tx/stats test This commit adds a kselftest (test_vcan_stats) that creates a vcan0 interface in a network namespace, transmits CAN frames from concurrent threads while reading /proc/net/dev in parallel, and verifies monotonic reads and exact packet and byte counter deltas. > diff --git a/tools/testing/selftests/net/can/test_vcan_stats.c b/tools/te= sting/selftests/net/can/test_vcan_stats.c > new file mode 100644 > index 0000000000000..aca72cc0995fe > --- /dev/null > +++ b/tools/testing/selftests/net/can/test_vcan_stats.c [ ... ] > +static void *stats_reader(void *arg) > +{ > + struct net_dev_stats prev =3D {}, st; > + unsigned long reads =3D 0; > + > + pthread_barrier_wait(&start_barrier); > + > + while (!atomic_load(&stop_reader)) { [Severity: Medium] Can stats_reader() exit without performing any /proc/net/dev reads and cause EXPECT_GT(atomic_load(&reader_reads), 0UL) to fail spuriously? pthread_barrier_wait() only synchronizes arrival, not scheduling order. On a busy host or single-vCPU VM, all tx_worker() threads can finish their 1000 writes to vcan0 and be joined before stats_reader() runs again: stats_reader tx_worker / main pthread_barrier_wait() pthread_barrier_wait() tx_worker() writes all frames and exits main joins tx_worker threads atomic_store(&stop_reader, 1) while (!atomic_load(&stop_reader)) <-- exits with 0 reads EXPECT_GT(reader_reads, 0UL) fails Using a do { ... } while (!atomic_load(&stop_reader)) loop in stats_reader() ensures at least one read completes. [ ... ] > +TEST(vcan_concurrent_tx_stats) > +{ > + struct net_dev_stats before, after; > + pthread_t tx[NUM_THREADS], reader; > + unsigned long long exp_pkts, exp_bytes; > + int probe_sock, ret; > + > + probe_sock =3D socket(PF_CAN, SOCK_RAW, CAN_RAW); > + if (probe_sock < 0) { > + if (errno =3D=3D EPROTONOSUPPORT || errno =3D=3D EAFNOSUPPORT) > + SKIP(return, "CAN_RAW protocol not supported"); [Severity: Medium] Does SKIP() here cause test_vcan_stats.sh to report pass instead of skip when CAN_RAW is unavailable? In kselftest_harness.h, __test_passed() treats KSFT_SKIP as passed, so test_harness_run() calls ksft_exit(ret =3D=3D 0) and exits with 0 instead of KSFT_SKIP (4). test_vcan_stats.sh checks for rc =3D=3D ksft_skip, so when CONFIG_CAN_VCAN is enabled without CONFIG_CAN_RAW it falls into the else branch and exits 0. Probing the CAN_RAW socket in main() before test_harness_run() and exiting with ksft_exit_skip() would return KSFT_SKIP to the wrapper. [ ... ] > diff --git a/tools/testing/selftests/net/can/test_vcan_stats.sh b/tools/t= esting/selftests/net/can/test_vcan_stats.sh > new file mode 100755 > index 0000000000000..2d182dd47b94f > --- /dev/null > +++ b/tools/testing/selftests/net/can/test_vcan_stats.sh [ ... ] > +test_vcan_stats() > +{ > + local rc > + > + ip netns exec "$ns" ./test_vcan_stats > + rc=3D$? > + if ((rc =3D=3D ksft_skip)); then > + log_test_skip "test_vcan_stats" > + else > + RET=3D$rc > + log_test "test_vcan_stats" > + fi > +} [Severity: Medium] Can assigning the raw exit status to RET mask failures as a pass in EXIT_STATUS? log_test() merges RET into EXIT_STATUS via ksft_exit_status_merge(), which only assigns weights to ksft_xfail (2), ksft_pass (0), ksft_skip (4), and ksft_fail (1): tools/testing/selftests/net/lib.sh:__ksft_status_merge() { ... if [[ ${weights[$a]} -ge ${weights[$b]} ]]; then echo "$a" return 0 ... } If ./test_vcan_stats crashes or is missing (for example rc=3D127 or 139), weights[$rc] is empty and evaluates to 0, which loses to weights[0]=3D1 and leaves EXIT_STATUS at 0. An rc of 2 is also treated as xfail and leaves EXIT_STATUS at 0. Normalizing non-zero rc to ksft_fail (or using check_err $rc with RET=3D0) avoids masking these failures. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203120559.4216= 46-1-rameshsv06@gmail.com?part=3D2