From: netdev-bot+sashiko@kernel.org
To: kalpan.jani@mpiricsoftware.com
Cc: mptcp@lists.linux.dev, shardul.b@mpiricsoftware.com,
janak@mpiric.us, kalpanjani009@gmail.com, pabeni@redhat.com,
kuba@kernel.org
Subject: Re: [PATCH mptcp-next v7 2/2] selftests: mptcp: bpf: exercise the subflow avoid flag across rounds
Date: Wed, 25 Nov 2026 01:31:18 +0000 [thread overview]
Message-ID: <179557027850.3133.2018668236611241328@kernel.org> (raw)
In-Reply-To: <20261123123730.3265284-3-kalpan.jani@mpiricsoftware.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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] In tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c,
bpf_avoid_get_send() always returns 0, including when it scheduled no…
- [Low] bpf_avoid_get_send() in
tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c treats `avoid` as…
- [Low] The commit message misdescribes the extern declarations.
--
selftests: mptcp: bpf: exercise the subflow avoid flag across rounds
This adds a BPF struct_ops MPTCP scheduler selftest. The scheduler calls
mptcp_subflow_set_avoid() once, on the second subflow, and in later rounds
relies on reading the avoid flag back. Per-msk state lives in SK_STORAGE,
and the harness checks that the avoided path carried no data.
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/349
> Add a BPF struct_ops scheduler selftest for mptcp_subflow_set_avoid(),
> and add the required extern declarations for it and for
> mptcp_subflow_active(), both declared locally in this file rather
> than in the shared mptcp_bpf.h. mptcp_subflow_active()'s extern was
> missing here even though the other BPF scheduler progs already have
> it (see mptcp_bpf_burst.c).
[Severity: Low]
Is this description accurate? mptcp_bpf_avoid.c is a new file, so the
extern can't have been missing from it before.
Among the existing scheduler progs, only mptcp_bpf_burst.c declares
mptcp_subflow_active(). mptcp_bpf_rr.c, mptcp_bpf_red.c, mptcp_bpf_first.c
and mptcp_bpf_bkup.c don't declare it, and mptcp_bpf.h doesn't either.
The message also doesn't say why both externs stay local. The extern for
the sibling kfunc mptcp_subflow_set_scheduled() is in mptcp_bpf.h. The
preceding patch, "mptcp: sched: add subflow avoid flag for BPF
schedulers", registers mptcp_subflow_set_avoid() in the same kfunc set in
net/mptcp/bpf.c.
Could this wording be left over from an earlier revision?
> diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c
> new file mode 100644
> index 0000000000000..8276ceb0e5397
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c
> @@ -0,0 +1,87 @@
[ ... ]
> +SEC("struct_ops")
> +int BPF_PROG(bpf_avoid_get_send, struct mptcp_sock *msk)
> +{
> + struct mptcp_subflow_context *subflow;
> + struct mptcp_subflow_context *first = NULL;
> + struct mptcp_avoid_storage *ptr;
> +
> + ptr = bpf_sk_storage_get(&mptcp_avoid_map, msk, 0,
> + BPF_LOCAL_STORAGE_GET_F_CREATE);
> + if (!ptr)
> + return -1;
> +
[ ... ]
> + bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) {
> + if (!first) {
> + first = subflow;
> + continue;
> + }
> +
> + if (!ptr->avoid_marked) {
> + mptcp_subflow_set_avoid(subflow, true);
> + ptr->avoid_marked = true;
> + continue;
> + }
> +
> + if (subflow->avoid)
> + continue;
[Severity: Low]
Should avoid be a hard exclusion here? struct mptcp_subflow_context
documents the field as:
bool avoid; /* pkt scheduler: skip subflow if possible */
Once avoid_marked is set, this loop always skips the avoided subflow. The
fallback after the loop only schedules first, and only when first is
active and not avoided.
That leaves nothing scheduled in at least two cases:
- The head subflow goes stale. mptcp_pm_subflow_chk_stale() only marks
it stale when another active subflow exists, and here that is the
avoided one.
- The head subflow is closed or reset. The avoided subflow then becomes
first and is rejected by !first->avoid.
No get_retrans op is set, so retransmissions also go through get_send and
stall the same way. On the __mptcp_push_pending() path, nothing is sent on
any retry.
Could the scheduler fall back to the avoided subflow when no other
subflow is usable?
> +
> + if (mptcp_subflow_active(subflow)) {
> + mptcp_subflow_set_scheduled(subflow, true);
> + return 0;
> + }
> + }
> +
> + if (first && mptcp_subflow_active(first) && !first->avoid)
> + mptcp_subflow_set_scheduled(first, true);
> +
> + return 0;
[Severity: Medium]
Can this return 0 even when no subflow was scheduled? The core reads a 0
return from get_send as "a subflow has been scheduled".
The in-tree implementations return an error when they find nothing.
mptcp_sched_default_get_send() returns -EINVAL, and the get_send ops in
mptcp_bpf_first.c and mptcp_bpf_burst.c return -1.
In __mptcp_subflow_push_pending(), the scheduler exit is only taken on a
nonzero return:
net/mptcp/protocol.c:__mptcp_subflow_push_pending() {
...
while (mptcp_send_head(sk) && keep_pushing) {
...
if (mptcp_sched_get_send(msk))
goto out;
if (READ_ONCE(subflow->scheduled)) {
...
}
mptcp_for_each_subflow(msk, subflow) {
if (READ_ONCE(subflow->scheduled)) {
...
keep_pushing = false;
...
}
...
}
If the return is 0 and nothing is scheduled, keep_pushing stays true. The
BPF prog then sees the same state on every iteration.
Doesn't this loop then spin forever in softirq with the msk data lock
held?
One way to get there, starting from the stale case above:
mptcp_pm_subflow_chk_stale()
subflow->stale = 1; /* head subflow; the avoided one is active */
__mptcp_retransmit_pending_data(sk);
and then a DATA_ACK arrives on the avoided subflow:
ack_update_msk()
__mptcp_check_push()
__mptcp_subflow_push_pending()
mptcp_sched_get_send()
bpf_avoid_get_send() /* returns 0, nothing scheduled */
Closing or resetting the initial subflow leads to the same state.
mptcp_subflow_process_delegated() is another entry into this loop.
The core's missing guard here is pre-existing, and mptcp_bpf_bkup.c uses
the same return 0 pattern. Because this scheduler excludes a subflow on
purpose, the empty case is more likely here.
Would returning -1 when nothing was scheduled avoid this? The function
already does that for the !ptr case.
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123123730.3265284-1-kalpan.jani%40mpiricsoftware.com
prev parent reply other threads:[~2026-11-25 1:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 12:37 [PATCH mptcp-next v7 0/2] mptcp: add scheduler-owned subflow avoid flag Kalpan Jani
2026-11-23 12:37 ` [PATCH mptcp-next v7 1/2] mptcp: sched: add subflow avoid flag for BPF schedulers Kalpan Jani
2026-11-23 12:47 ` sashiko-bot
2026-11-25 1:31 ` netdev-bot+sashiko
2026-11-23 12:37 ` [PATCH mptcp-next v7 2/2] selftests: mptcp: bpf: exercise the subflow avoid flag across rounds Kalpan Jani
2026-11-23 12:52 ` sashiko-bot
2026-11-25 1:31 ` 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=179557027850.3133.2018668236611241328@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=janak@mpiric.us \
--cc=kalpan.jani@mpiricsoftware.com \
--cc=kalpanjani009@gmail.com \
--cc=kuba@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=shardul.b@mpiricsoftware.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.