From: netdev-bot+sashiko@kernel.org
To: omar@blockcast.net
Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
horms@kernel.org
Subject: Re: [PATCH net-next v3 2/3] amt: bound the source-state work of one Membership Update
Date: Mon, 23 Nov 2026 23:57:42 +0000 [thread overview]
Message-ID: <179547826290.3135.17087083328500674943@kernel.org> (raw)
In-Reply-To: <20261122235724.2898320-3-omar@blockcast.net>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The constants that size the new work budget are documented as
exact maxima, but the code never reaches them.
- [Low] The patch fixes a long-standing CPU amplification but carries no
Fixes: tag.
--
amt: bound the source-state work of one Membership Update
This commit charges each group record in an IGMPv3 or MLDv2 Membership
Update for the bucket walks and per-source lookups it causes. It stops
applying records once the total exceeds twice the cost of refreshing every
group and source the tunnel may hold. Records for groups the tunnel has no
room for are skipped and not charged.
> Found by review (Sashiko, on the limits patch); not triggered at runtime.
>
> Assisted-by: LLM
> Signed-off-by: Omar Ramadan <omar@blockcast.net>
[Severity: Low]
Should this patch carry a Fixes: tag?
Before this patch, ip_mc_may_pull() was the only limit on how many records
amt_igmpv3_report_handler() and amt_mldv2_report_handler() applied under
tunnel->lock in softirq. A reassembled UDP Update of up to about 64 KB can
carry thousands of 8-byte records against one full group.
That behaviour seems to go back to bc54e49c140b ("amt: add multicast(IGMP)
report message handler") and the matching MLDv2 report handler commit.
An earlier fix in this area, 5931fd2440de ("amt: fix use-after-free when a
Membership Update re-arms a freed tunnel"), also addressed a theoretical
issue. It carries Fixes: tags against bc54e49c140b and cbc21dc1cfe9. With no
tag here, backport tooling can't tell which trees need this limit.
The "on the limits patch" note seems to refer to a later patch in this
series, "amt: make the per-tunnel group and source limits configurable".
That note does not take the place of a Fixes: tag. The series adds UAPI, so
it may be net-next material either way, and this could be treated as
hardening.
[ ... ]
> diff --git a/include/net/amt.h b/include/net/amt.h
> index f36efcdd92d0b..96357b3e32fc9 100644
> --- a/include/net/amt.h
> +++ b/include/net/amt.h
> @@ -392,6 +392,12 @@ struct amt_dev {
> #define AMT_GC_KICK 2048
> #define AMT_MAX_GROUP 32
> #define AMT_MAX_SOURCE 128
> +/* Per group record, the most passes the mode handlers plus
> + * amt_cleanup_srcs() make over a group's sources, and the most hash
> + * lookups they make per record source. See amt_rec_cost().
> + */
> +#define AMT_REC_WALKS 7
> +#define AMT_REC_LOOKUPS 8
[Severity: Low]
Are 7 and 8 really the maximum counts this comment describes?
In amt_lookup_act_srcs(), only AMT_OPS_UNI and AMT_OPS_SUB walk every bucket
of gnode->sources[]. AMT_OPS_INT does one amt_lookup_src() per record
source, and AMT_OPS_SUB_REV does up to two.
The most full passes seem to come from amt_mcast_to_in_handler() in EXCLUDE
mode, which makes three AMT_OPS_UNI calls:
drivers/net/amt.c:amt_mcast_to_in_handler() {
...
} else {
amt_lookup_act_srcs(tunnel, gnode, grec, AMT_OPS_UNI,
AMT_FILTER_NONE_NEW, ...
amt_lookup_act_srcs(tunnel, gnode, grec, AMT_OPS_UNI,
AMT_FILTER_FWD, ...
amt_lookup_act_srcs(tunnel, gnode, zero_grec, AMT_OPS_UNI,
AMT_FILTER_D_FWD, ...
amt_lookup_act_srcs(tunnel, gnode, grec, AMT_OPS_INT,
AMT_FILTER_FWD_NEW, ...
}
}
The two bucket loops in amt_cleanup_srcs() bring that to 5 passes.
The most lookups per source seem to come from amt_mcast_block_handler() in
EXCLUDE mode. That is SUB_REV (2) + UNI (1) + SUB_REV (2) + UNI (1) = 6,
plus one in amt_add_srcs(), for 7. amt_act_src() starts no further walks.
The commit message figure also seems to rely on the higher pass count:
"At the current defaults a 1.5 KB Update of about 180 empty records
against one group already walks the group's 256 buckets over a thousand
times."
At 5 passes per record, that would be about 178 x 5, or roughly 890.
amt_rec_cost() and amt_report_budget() use the same constants, so behaviour
does not change and the budget is still conservative.
Should the constants be 5 and 7? Or should the comment say they are
deliberately rounded-up bounds? The later patch "amt: make the per-tunnel
group and source limits configurable" leaves both constants and their
comment unchanged.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122235724.2898320-1-omar%40blockcast.net
next prev parent reply other threads:[~2026-11-23 23:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 23:57 [PATCH net-next v3 0/3] amt: configurable per-tunnel limits, with bounded report work Omar Ramadan
2026-11-22 23:57 ` [PATCH net-next v3 1/3] amt: make the A-B source walk linear Omar Ramadan
2026-11-22 23:57 ` [PATCH net-next v3 2/3] amt: bound the source-state work of one Membership Update Omar Ramadan
2026-11-23 23:57 ` netdev-bot+sashiko [this message]
2026-11-22 23:57 ` [PATCH net-next v3 3/3] amt: make the per-tunnel group and source limits configurable Omar Ramadan
2026-11-23 23:57 ` netdev-bot+sashiko
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=179547826290.3135.17087083328500674943@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omar@blockcast.net \
--cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®