All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jason Xing" <kerneljasonxing@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 6/6] selftests/bpf: Add RX latency tests for bpf timestamping
Date: Sat, 30 May 2026 00:46:03 +0000	[thread overview]
Message-ID: <20260530004603.E47471F0089C@smtp.kernel.org> (raw)
In-Reply-To: <20260521135244.40869-7-kerneljasonxing@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Using a fixed 10ms sleep to synchronize with a kernel workqueue introduces a race condition that can lead to flaky tests.
- [Low] Unescaped newline in string literal causes compilation failure.
--

commit fd07aa65d96b1e91b17cb391aadbc4cf4af4b414
Author: Jason Xing <kerneljasonxing@gmail.com>

selftests/bpf: Add RX latency tests for bpf timestamping

This patch extends the test_tcp() functionality to cover the new BPF RX
timestamping path. It adds new assertions, workqueue synchronization, and mixed
timestamping modes to verify SO_TIMESTAMPING and BPF RX can function together
without conflict.

> diff --git a/tools/testing/selftests/bpf/prog_tests/net_timestamping.c b/tools/testing/selftests/bpf/prog_tests/net_timestamping.c
> index dbfd87499b6b5..e3fe850e4cc70 100644
> --- a/tools/testing/selftests/bpf/prog_tests/net_timestamping.c
> +++ b/tools/testing/selftests/bpf/prog_tests/net_timestamping.c

[ ... ]

> @@ -143,11 +143,47 @@ static void test_socket_timestamping(int fd)
>  	SK_TS_ACK = 0;
>  }
>  
> +static bool recv_verify_rx_timestamp(int fd, char *buf, int len)
> +{

[ ... ]

> +	if (!ASSERT_TRUE(tss != NULL, "SCM_TIMESTAMPING cmsg present") ||
> +	    !ASSERT_TRUE(tss->ts[0].tv_sec || tss->ts[0].tv_nsec, "rx sw
> +			 timestamp non-zero"))

[Severity: Low]
Does this unescaped newline in the string literal cause a compilation failure?

The error message string is split across lines without a trailing backslash or
string concatenation, which results in invalid syntax in C.

> +		return false;
> +
> +	return true;
> +}
> +
>  static void test_tcp(int family, bool enable_socket_timestamping)
>  {

[ ... ]

> +	afd = accept(sfd, NULL, NULL);
> +	if (!ASSERT_OK_FD(afd, "accept"))
> +		goto out;
> +
> +	/* net_enable_timestamp() defers the static key update via
> +	 * schedule_work() when CONFIG_JUMP_LABEL is set. Give the
> +	 * workqueue a chance to run so that netstamp_needed_key is
> +	 * active and skb->tstamp gets populated in the receive path.
> +	 */
> +	usleep(10000);

[Severity: Medium]
Will this hardcoded 10ms sleep cause the test to become flaky?

Using fixed delays to synchronize with asynchronous kernel workqueues can lead
to race conditions. In slow VMs or heavily loaded CI systems, the workqueue
might take longer than 10ms to run, leaving skb->tstamp unpopulated and
causing the test to fail intermittently.

Could a polling mechanism with a reasonable timeout be used here instead?

> +
>  	if (enable_socket_timestamping) {
> +		unsigned int rx_opt;

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260521135244.40869-1-kerneljasonxing@gmail.com?part=6

  reply	other threads:[~2026-05-30  0:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 13:52 [PATCH net-next v2 0/6] bpf-timestamp: support rx side Jason Xing
2026-05-21 13:52 ` [PATCH net-next v2 1/6] bpf: Add bpf_ktime_get_real_ns() kfunc Jason Xing
2026-05-21 13:52 ` [PATCH net-next v2 2/6] net: export sock_disable_timestamp() declaration Jason Xing
2026-05-30  0:46   ` sashiko-bot
2026-05-21 13:52 ` [PATCH net-next v2 3/6] bpf: support bpf_setsockopt for bpf timestamping rx feature Jason Xing
2026-05-23  4:02   ` Kuniyuki Iwashima
2026-05-30  0:46   ` sashiko-bot
2026-05-21 13:52 ` [PATCH net-next v2 4/6] bpf: add BPF_SOCK_OPS_TSTAMP_RCV_CB callback Jason Xing
2026-05-30  0:46   ` sashiko-bot
2026-05-21 13:52 ` [PATCH net-next v2 5/6] bpf: enable bpf timestamping rx in TCP layer Jason Xing
2026-05-23  3:45   ` Kuniyuki Iwashima
2026-05-28  0:50     ` Jason Xing
2026-05-21 13:52 ` [PATCH net-next v2 6/6] selftests/bpf: Add RX latency tests for bpf timestamping Jason Xing
2026-05-30  0:46   ` sashiko-bot [this message]
2026-05-23  3:47 ` [PATCH net-next v2 0/6] bpf-timestamp: support rx side Kuniyuki Iwashima
2026-05-28  0:50   ` Jason Xing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260530004603.E47471F0089C@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.