Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jhs@mojatatu.com
Cc: netdev@vger.kernel.org, toke@toke.dk, jiri@resnulli.us,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, victor@mojatatu.com,
	cake@lists.bufferbloat.net
Subject: [Cake] Re: [PATCH net-next 1/4] net/sched/sch_cake: serialize reconfiguration with the datapath
Date: Mon, 12 Oct 2026 08:15:50 +0000	[thread overview]
Message-ID: <179179295072.434549.14420097203687581555@kernel.org> (raw)
In-Reply-To: <QDISC-5RTM.v1.20261007130704-2@mojatatu.com>

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 commit fixes a real, user-visible lost update but has no
  Fixes: tag.
- [Low] The reproduction section contradicts itself, and its KCSAN recipe
  does not trigger the lost update the message describes.

--

net/sched/sch_cake: serialize reconfiguration with the datapath

This patch moves the cake_config_change() commit in cake_change() under
sch_tree_lock(), so it no longer races with the autorate-ingress rate
update in cake_enqueue(). It also converts cake_sched_config.rate_bps to
atomic64_t so that 64-bit rate stores are atomic on 32-bit machines.

Link: https://sashiko.dev/#/patchset/20260816012109.2865223-1-ooonea@gmail.com
Link: https://lore.kernel.org/netdev/20260816012109.2865223-1-ooonea@gmail.com/

> This is a follow-up to commit 7cbfb180945c ("net/sched: sch_cake: fix
> autorate reconfiguration throttling").  That change only stored
> last_reconfig_time; it did not address the concurrency between the
> autorate rate update in cake_enqueue() and the netlink reconfiguration
> path, which the original review flagged.

[ ... ]

> Reported-by: Sashiko (gemini) <sashiko-bot@kernel.org>
> Link: https://sashiko.dev/#/patchset/20260816012109.2865223-1-ooonea@gmail.com
> Link: https://lore.kernel.org/netdev/20260816012109.2865223-1-ooonea@gmail.com/
> Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

[Severity: Low]
Should this have a Fixes: tag?

Before this patch, cake_change() called cake_config_change() with only
RTNL held. The sch_tree_lock() covered only cake_reconfigure(). The
autorate store in cake_enqueue() runs under the qdisc root lock:

    q->config->rate_bps = (q->avg_peak_bandwidth * 15) >> 4;

Commit 7cbfb180945c only added the last_reconfig_time store and did not
introduce the race. Both racing writers go back to 7298de9cd725, and
7cbfb180945c lists that same commit in its own Fixes: tag.

Without a tag, stable selection may miss this fix. Would something like
this be appropriate?

    Fixes: 7298de9cd725 ("sch_cake: Add ingress mode")

> Conditions to recreate the bug: build with CONFIG_KCSAN=y (the race is
> otherwise not observable on 64-bit), put cake in autorate-ingress on a
> device, drive bursty traffic with gaps so the 250ms autorate
> reconfiguration fires, and concurrently loop 'tc qdisc change dev ...
> cake bandwidth <N>kbit autorate-ingress'.  The lost update of the
> installed rate is reproducible without a sanitizer by running bursty
> senders while repeatedly changing an autorate qdisc to a fixed
> 'bandwidth X' and reading the installed rate back.

[Severity: Low]
Do these two recipes describe the same bug?

The KCSAN loop passes autorate-ingress, so cake_config_change() keeps
CAKE_FLAG_AUTORATE_INGRESS set:

    if (tb[TCA_CAKE_AUTORATE]) {
        if (!!nla_get_u32(tb[TCA_CAKE_AUTORATE])) {
            ...
            rate_flags |= CAKE_FLAG_AUTORATE_INGRESS;
        } else {
            rate_flags &= ~CAKE_FLAG_AUTORATE_INGRESS;
        }
    }

With autorate still enabled, the next estimate is supposed to replace N.
That loop would produce a KCSAN data-race report on rate_bps. It would
not show the lost configured rate from the race diagram, which needs a
change that clears autorate ('bandwidth X' without autorate-ingress).

Also, "the race is otherwise not observable on 64-bit" seems to
contradict the next sentence. The lost update does not depend on a torn
store, so it happens on 64-bit too. Only the torn 64-bit store is
specific to 32-bit.

Could the reproduction section keep the two effects separate and give a
recipe that matches the race diagram?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-5RTM.v1.20261007130704%40mojatatu.com

  parent reply	other threads:[~2026-10-12  8:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  7:47 [Cake] [PATCH net-next 0/4] net/sched: sch_cake: fixes for accounting and reconfiguration Jamal Hadi Salim
2026-10-08  7:47 ` [Cake] [PATCH net-next 1/4] net/sched/sch_cake: serialize reconfiguration with the datapath Jamal Hadi Salim
2026-10-08 10:06   ` [Cake] " Toke Høiland-Jørgensen
2026-10-08 11:53     ` Jamal Hadi Salim
2026-10-08 12:03       ` Toke Høiland-Jørgensen
2026-10-12  8:15   ` netdev-bot+sashiko [this message]
2026-10-08  7:47 ` [Cake] [PATCH net-next 2/4] net/sched/sch_cake: reduce parent backlog when clearing a tin Jamal Hadi Salim
2026-10-08 10:19   ` [Cake] " Toke Høiland-Jørgensen
2026-10-12  8:15   ` netdev-bot+sashiko
2026-10-08  7:47 ` [Cake] [PATCH net-next 3/4] net/sched/sch_cake: widen buffer_used to u64 Jamal Hadi Salim
2026-10-08 10:24   ` [Cake] " Toke Høiland-Jørgensen
2026-10-12  8:15   ` netdev-bot+sashiko
2026-10-08  7:47 ` [Cake] [PATCH net-next 4/4] net/sched/sch_cake: drop dead nla_nest_end() error check Jamal Hadi Salim
2026-10-08 10:24   ` [Cake] " Toke Høiland-Jørgensen

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

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

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

  git send-email \
    --in-reply-to=179179295072.434549.14420097203687581555@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=cake@lists.bufferbloat.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@toke.dk \
    --cc=victor@mojatatu.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