🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #611

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

#611
From: Toke Høiland-Jørgensen
Date: Thu, 08 Oct 2026 10:06
34 lines
6133 bytes
> The qdisc is left with autorate disabled but with the estimate installed
> instead of X.  On 32-bit machines the unlocked 64-bit rate_bps store is
> also not atomic, so a reader can observe a torn rate.  iproute2 reaches
> this because parsing 'bandwidth X' sets autorate = 0 and emits both
> TCA_CAKE_BASE_RATE64 and TCA_CAKE_AUTORATE.
>
> Commit the parsed configuration and reconfigure while holding the same
> qdisc lock that serializes the datapath, so the netlink writer and the
> autorate writer can no longer interleave.  Make rate_bps an atomic64_t
> so a 64-bit rate update is atomic on 32-bit machines as well, and keep
> the READ_ONCE()/WRITE_ONCE() annotations for the remaining lockless
> readers (cake_config_dump(), which runs without the lock, and the
> cake_mq shared config, which readers observe under different child
> locks).

So atomic_t.txt has this section:

"SEMANTICS
---------

Non-RMW ops:

The non-RMW ops are (typically) regular LOADs and STOREs and are canonically
implemented using READ_ONCE(), WRITE_ONCE(), smp_load_acquire() and
smp_store_release() respectively. Therefore, if you find yourself only using
the Non-RMW operations of atomic_t, you do not in fact need atomic_t at all
and are doing it wrong."


So AFAICT, we don't need atomic_t, we just need READ/WRITE_ONCE()
annotations?

-Toke
Technical Details
Message-ID: <875wzctsky.fsf@toke.dk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342899-linux-kernel-netdev=dewy.ru
References: <QDISC-5RTM.v1.20261007130704@mojatatu.com> <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!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342899-linux-kernel-netdev=dewy.ru
From: toke@toke.dk (Toke Høiland-Jørgensen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/4] net/sched/sch_cake: serialize
 reconfiguration with the datapath
Date: Thu, 08 Oct 2026 12:06:05 +0200
Organization: Usenet Network
Message-ID: <875wzctsky.fsf@toke.dk>
References: <QDISC-5RTM.v1.20261007130704@mojatatu.com>
 <QDISC-5RTM.v1.20261007130704-2@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
	logging-data="857642"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xKwZDVUpdjlYwanE2wrTkLKY9/Y= sha256:CG2rdyzr84LUc+NbM4VtjLgjAK7i0Hc+gBv2exP/kXY=
	sha1:AvN6Sc4rqeKBQHec/sDXu5HeORw= sha256:8uGDOQ8SdVx4DC14iOPHIKy6ms3uR4V09juGcV2iCMM=
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 C7EE710F3A1; Thu,  8 Oct 2026 13:35:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.951
X-Spam-Status: No, score=-1.951 tagged_above=-9999 required=6.31
	tests=[DKIM_ADSP_ALL=1.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 ctB2z19SShcl;
	Thu,  8 Oct 2026 13:35:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342899-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=toke.dk
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0A8DE10F39A; Thu,  8 Oct 2026 13:35:39 +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 C039735158; Thu,  8 Oct 2026 10:35:36 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 30CA7495ACE;
	Thu,  8 Oct 2026 10:35:36 +0000 (UTC)
X-Received: from mail.toke.dk (mail.toke.dk [45.145.95.4])
	(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 620EB4963B6
	for <netdev@vger.kernel.org>; Thu,  8 Oct 2026 10:35:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.145.95.4
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791455736; cv=none; b=UgeM1b6vlflJ1jRuBoR4EymU7gRBLQAKL14aUlTKm4dggLIdlitox2JQE3zyl0KY3IGgnWaLUV/vK9bVA6fSmF4g4FHrnO35HSf8S+MF6ShAiMv9O2fmNllxphP554lt6S6PmwrC2pHjpylxoZVZZ+xb5cYRspsvOeeT4+knGwI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791455736; c=relaxed/simple;
	bh=kEkkur79QevX+txJt91AJcN2J7iTC/G/g51RVOWejxA=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
	 MIME-Version:Content-Type; b=Zk/GakkreP2AjX0YairAKcLPW4EEZa8iHI0w0DwYzfP2qeccKMyowDDcC9Kd8HVZmhB7tT0p1QDQVjD3Yd3h2BhKdCYSHG0isMrdi6YHq/vH6v14l18njERz8BPh6M81NuyNpsZrtZnoKEO6tx4SOuy0MS9DD6gecdW14TuaXts=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toke.dk; spf=pass smtp.mailfrom=toke.dk; arc=none smtp.client-ip=45.145.95.4
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toke.dk
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toke.dk
X-Authentication-Results: mail.toke.dk; dkim=none
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>, Jiri Pirko <jiri@resnulli.us>,
 "David S . Miller" <davem@davemloft.net>, Eric Dumazet
 <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni
 <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
 cake@lists.bufferbloat.net, Victor Nogueira <victor@mojatatu.com>, Sashiko
 <sashiko-bot@kernel.org>
X-In-Reply-To: <QDISC-5RTM.v1.20261007130704-2@mojatatu.com>
X-Clacks-Overhead: GNU Terry Pratchett
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>