All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: zibuyu423@gmail.com
Cc: mptcp@lists.linux.dev, kuba@kernel.org
Subject: Re: [PATCH mptcp-next 2/2] selftests: mptcp: check the aggregate pacing rate across two paths
Date: Sat, 05 Dec 2026 05:06:42 +0000	[thread overview]
Message-ID: <179644720293.3143.8909258729569426518@kernel.org> (raw)
In-Reply-To: <179630953226.20.8856777451271939865.mptcp-578-0002@gmail.com>

Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 4

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] selftests: mptcp: mid-script mptcp_lib_kallsyms_has() aborts
  simult_flows.sh
- [Low] The new 'aggregate pacing rate' subtest in simult_flows.sh only
  checks that the rate is not exceeded.
- [Low] The 10% tolerance in the new pacing lower bound does not match
  its comment, and it leaves only a narrow margin over the script's own…
- [Low] The new -a option in mptcp_connect.c parses its argument with
  parse_int().
- [Low] selftests: mptcp: unconditional pacing checks overwrite retc in
  do_transfer()

--

selftests: mptcp: check the aggregate pacing rate across two paths

This commit adds a -a option to mptcp_connect, which sets
SO_MAX_PACING_RATE on the connecting socket. It also adds an "aggregate
pacing rate" subtest to simult_flows.sh. The subtest runs a transfer over
two 10 Mbit/s links with a 14 Mbit/s cap, then checks a minimum transfer
duration and that both egress interfaces sent at least 64 KiB.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/578

> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 8c788977e5947..9a601fe4493a4 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c

[ ... ]

> @@ -1588,6 +1595,9 @@ static void parse_opts(int argc, char **argv)
>  		case 'm':
>  			cfg_mode = parse_mode(optarg);
>  			break;
> +		case 'a':
> +			cfg_pacing_rate = parse_int(optarg);
> +			break;

[Severity: Low]
This isn't a bug, but parse_int() reports every failure as a sndbuf
problem:

tools/testing/selftests/net/mptcp/mptcp_connect.c:parse_int() {
    ...
	if (s > INT_MAX) {
		fprintf(stderr, "Invalid sndbuf size %s (%s)\n",
			size, strerror(ERANGE));
		die_usage();
	}
    ...
}

The errno path prints the same text. As a result, something like
"-a 3000000000" is reported as an invalid sndbuf size, while die_usage()
describes -a as setting SO_MAX_PACING_RATE. The -R option already has
this mismatch, and the new option adds another caller with it.

Could the message be made generic, or name the option being parsed?

>  		case 'S':
>  			cfg_sndbuf = parse_int(optarg);
>  			break;
> diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
> index 3ea3d1efe32e1..d4a6bda0e3a24 100755
> --- a/tools/testing/selftests/net/mptcp/simult_flows.sh
> +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh

[ ... ]

> @@ -184,6 +198,23 @@ do_transfer()
>  	wait $spid
>  	local rets=$?
>
> +	if ((rate)); then
> +		end=$(date +%s%N)
> +		elapsed=$(((end - start) / 1000000))
> +		# Allow one GSO burst and timer jitter at the endpoints.
> +		min_time=$((size * 1000 / rate * 90 / 100))

[Severity: Low]
Should these checks only run when both mptcp_connect instances
succeeded? The block runs right after the two wait calls, whatever
the values of retc and rets.

The client can fail early, for example when connect() fails, the poll
timeout fires, or the timeout job kills it. In that case elapsed is
below min_time and tx1/tx2 are under 64 KiB. The test then prints
"pacing: ..." and "path byte counts too low: ..." on top of the real
failure, and overwrites retc with 1.

The existing failure report in do_transfer() then shows the wrong
value:

	mptcp_lib_pr_fail "client exit code $retc, server $rets"

It prints 1 instead of the exit code mptcp_connect returned. That
exit code is the first thing someone debugging the failure needs.

If both processes exited 0 and only the pacing or byte-count check
failed, the same message reports "client exit code 1, server 0". That
points at mptcp_connect instead of the pacing check.

The subtest still fails in both cases, so no regression is hidden.
The output is just harder to interpret.

Could the checks be guarded on retc and rets both being 0? Could the
pacing failure also be tracked in a separate variable rather than by
reusing retc?

[Severity: Low]
Does this comment match the tolerance being applied? With the 16 MiB
payload and a rate of 1750000, min_time is 8627 ms. The 10% slack is
about 960 ms, which is roughly 1.68 MB at 1.75 MB/s.

On the kernel side, mptcp_pacing_account() allows idle credit of only
about one tick or one MPTCP_SEND_BURST_SIZE burst:

net/mptcp/protocol.c:mptcp_pacing_account() {
    ...
		credit = min_t(s64, hrtimer_resolution,
			       div64_ul((u64)MPTCP_SEND_BURST_SIZE * NSEC_PER_SEC, rate));
		credit = max(credit, interval / 2);
    ...
}

At this rate that is around 37 ms, so the slack covers about 25 bursts,
not one.

The elapsed window is also wider than the transfer itself. It starts
before ip netns exec launches the client and ends after wait $spid. It
also includes the 200 ms -j sleep on each side. Together this accepts a
sustained rate of roughly 16 Mbit/s rather than 14.

Is the margin over the per-path cap case wide enough? run_test() budgets
an unpaced 2x10 Mbit/s transfer as:

	local time=$((1000 * size  *  8  * 10 / ((rate1 + rate2) * 1000 * 1000 * 9) ))
	time=$((time + 400 + slack))

That comes to 7906 ms, or 8456 ms with the debug kernel slack, which is
only about 170 ms below the 8627 ms threshold.

On a slow or debug CI kernel, could a per-subflow cap implementation
take more than 8627 ms of shell wall time and still pass?

Could the comment be fixed? Could the threshold also be tightened, or be
based on a measured unpaced baseline?

> +		if ((elapsed < min_time)); then
> +			mptcp_lib_print_err "pacing: ${elapsed}ms, minimum ${min_time}ms"
> +			retc=1
> +		fi

[ ... ]

> @@ -309,6 +340,23 @@ done
>  setup
>  mptcp_lib_subtests_last_ts_reset
>  run_test 10 10 0 0  20 20 "balanced bwidth"
> +
> +# Keep the two 10-Mbit/s paths from the previous test. A 14-Mbit/s
> +# connection cap leaves room to use both while exposing independent caps.
> +msg="aggregate pacing rate"
> +mptcp_lib_print_title "$msg"
> +if mptcp_lib_kallsyms_has 'mptcp_pacing_account$'; then
> +	do_transfer "$large" "$small" "$((timeout_poll * 1000))" 1750000

[Severity: Medium]
Can this abort the rest of simult_flows.sh on a kernel built without
CONFIG_KALLSYMS? mptcp_lib_kallsyms_has() goes through
__mptcp_lib_kallsyms_has(), which calls mptcp_lib_check_kallsyms() in
mptcp_lib.sh:

mptcp_lib_check_kallsyms() {
	if ! mptcp_lib_has_file "/proc/kallsyms"; then
		mptcp_lib_pr_skip "CONFIG_KALLSYMS is missing"
		exit ${KSFT_SKIP}
	fi
}

mptcp_connect.sh, mptcp_join.sh, mptcp_sockopt.sh and userspace_pm.sh
all call mptcp_lib_check_kallsyms() at startup. simult_flows.sh only
calls mptcp_lib_check_mptcp() and mptcp_lib_check_tools(). Until now
it ran to completion without /proc/kallsyms, because the grep in
setup() is not fatal.

With this patch, the script exits with KSFT_SKIP in the middle of the
run, right after the "balanced bwidth" subtests. This has three
effects:

- The four remaining run_test() calls never run.
- mptcp_lib_result_print_all_tap() is never reached.
- A failure already recorded in ret by the first subtests is reported
  as a skip.

The config fragment in this directory sets CONFIG_KALLSYMS=y, so
default selftest builds are fine. Other CI configurations may not
enable it, though.

Should the script call mptcp_lib_check_kallsyms() at startup like its
siblings do? That would skip the whole script on such kernels.
Alternatively, the test could check for /proc/kallsyms before calling
mptcp_lib_kallsyms_has(), so only the new subtest is skipped. Which
behaviour do you prefer here?

[Severity: Low]
Can this subtest catch a pacer that throttles too much? do_transfer()
checks only a lower bound on elapsed time and a 64 KiB floor per egress
interface:

		if ((tx1 < 65536 || tx2 < 65536)); then

That floor is under 0.4% of the 16 MiB payload.

The only upper bound is the max_time passed here, timeout_poll * 1000 =
30000 ms, which mptcp_connect enforces through -T. That works out to
about 4.5 Mbit/s of goodput, which is below a single 10 Mbit/s link.

These pacer regressions would still pass:

- Charging the shared msk deadline twice per send halves the rate to
  about 7 Mbit/s, so the transfer takes about 19 s.
- Starving one subflow, so nearly all data goes over one 10 Mbit/s path,
  takes about 14-15 s. A little traffic on the second subflow still
  clears the 64 KiB floor.

The kernel change "mptcp: support a connection-wide SO_MAX_PACING_RATE"
says a fixed split "would waste bandwidth when a path is idle". The
comment above also says the 14 Mbit/s cap "leaves room to use both"
paths.

The test does catch independent per-path caps near 20 Mbit/s, which is
the case the commit message names. However, the subject says it checks
"the aggregate pacing rate across two paths".

Could an upper bound be added? One option is size / rate plus the 400 ms
of join sleeps plus slack, as run_test() does. Another is to require
elapsed to stay below the single-link transfer time. If neither fits,
should the commit message say that only a minimum duration is enforced?

> +	rc=$?
> +	mptcp_lib_result_code "$rc" "$msg"

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179630953225.20.4977913523988952504.mptcp-578-0000%40gmail.com

      parent reply	other threads:[~2026-12-05  5:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 14:53 [PATCH mptcp-next 0/2] mptcp: pace subflows against a connection-wide rate limit Ruilin Mao
2026-12-03 14:53 ` [PATCH mptcp-next 1/2] mptcp: support a connection-wide SO_MAX_PACING_RATE Ruilin Mao
2026-12-03 15:29   ` sashiko-bot
2026-12-05  5:06   ` netdev-bot+sashiko
2026-12-03 14:53 ` [PATCH mptcp-next 2/2] selftests: mptcp: check the aggregate pacing rate across two paths Ruilin Mao
2026-12-03 15:09   ` sashiko-bot
2026-12-05  5:06   ` netdev-bot+sashiko [this message]

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=179644720293.3143.8909258729569426518@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=kuba@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=zibuyu423@gmail.com \
    /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.