๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2174

Re: [PATCH net-next 1/4] net/sched/sch_cake: serialize reconfiguration with the datapath

#2174
From: netdev-bot+sashiko
Date: Mon, 12 Oct 2026 08:15
95 lines
9616 bytes
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
Technical Details
Message-ID: <179179295072.434549.14420097203687581555@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344790-linux-kernel-netdev=dewy.ru
References: <QDISC-5RTM.v1.20261007130704-2@mojatatu.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344790-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/4] net/sched/sch_cake: serialize reconfiguration with the datapath
Date: Mon, 12 Oct 2026 08:15:50 +0000
Organization: Usenet Network
Message-ID: <179179295072.434549.14420097203687581555@kernel.org>
References: <QDISC-5RTM.v1.20261007130704-2@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1716038"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:e5LcrB0w4A5gFhlK0hriqr54nMg= sha256:hCTJSb0HLe7BR8vGvrDdjRGxNfIu/0vYMas+GNhEjS4= sha1:DdjCyWrBO5H7Azb3PTQEPCTfh2s= sha256:/9Xu60BKryA91jZMqDABRtqAeXfLfv9yVoIuc/LwUy8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 3E32B10FB30; Mon, 12 Oct 2026 11:16:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.34
X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5QAZ4m9HCnzK; Mon, 12 Oct 2026 11:16:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-344790-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 56EAA10FB03; Mon, 12 Oct 2026 11:16:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 63D3537076; Mon, 12 Oct 2026 08:15:53 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44F7A44684B; Mon, 12 Oct 2026 08:15:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X3QqY5vf"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1269F44AB95 for <netdev@vger.kernel.org>; Mon, 12 Oct 2026 08:15:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791792953; cv=none; b=MVdxnBCa9E2DQIcduylr0uEmamDCg+H76Qm9/WV0t428apdAr4UEdLou8+G+wgu5cC8/Ph3+mSwNlyPzF9AAb/Fme3t5HDcEftyXbx1JFgX+ckIgmTq59rYX1iP5ZZmv0e3fFqgdKUNN4YiygjxSGPK49FkhIshrflEHb2HTGoc=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791792953; c=relaxed/simple; bh=ElYUggeh4S0aOVDROsbGLtvpr63iV/7x3ZP6Z1kkTMc=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=j1yjf5S7A99q8R64mZ3kuhq+Jr0I4hPEg99SFvsxAI8zn34+Se3S2np8U/e0ESdGLmy9TLONSee+/rozDWrePchYPDpLgdHGIHz+LxTazmiKfmM+eskNE1kheGDASsHgjnYzH/HGpQwLZvd3QhgiWU/KWyIWFj6nofwKvq622Uc=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X3QqY5vf; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22D631F0089C; Mon, 12 Oct 2026 08:15:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791792951; bh=4pPk1ouWAUwePu8xGjsuldobGtH/1bk57llpUOu6BEo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=X3QqY5vfRKCV8wGyBfWOgaBCl4vpKCc3Qnr+TE80NXulNj3/098Bmnqc3Lj+WwGj3 qc1uzqJ6Oixiyw0myV7x08GijCobqvUo1/PLmRexFIYOQSyoFl7A8EFwcCA+/WDhxk KD3cB2pRvz755ofwiYYC7qc7cv2dfJDDIkZbXQMnwVYNJTdqGJ6OGoSef/JSqYWaHl gsWSt52OQOGtNWY0ojhlMCjRfUWrFAamZD4+sshbszL1BbsXRuOb5rQh2g1iz65977 0btTHBKCr6tdjXS3MZzHQZwS+jOb7FYjZq8TmElS5zyCP963E7nLIIGJpmuavfXnAQ Ad3kaYOj/ytDQ==
X-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
X-In-Reply-To: <QDISC-5RTM.v1.20261007130704-2@mojatatu.com>
X-sashiko-severity: Low
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-Received-Bytes: 9410