From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.55 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796085315; b=An9JXSx1C+Vs6aen230yjpdb+sGeZalK9pLCXK8NHN1sLWLT7bEApx3ToDG5Nrtkft0H 9HUakl+eIIgJdTXLMioAllRWr98M/NibxcfG3jvuwdUX0rVK/8TdvSNXWP36pJcIw+ZMZ CA1FD3pnfQ0oRM++VNGfkeDsoOj5/Z7gNw45mAnYQKMqgE4pGiVndAzKdCn79felFQxEz HGKypBIQTpo6SBYj8UbcGu9t+L58l6PboXEiymC1ObnDSvFyFe/j4FyMQi07IxWEJNdr0 e1ImM1tP7C/Qa7wn5gA+TXgzyB98AwQZD3wI0Bvt1ilneNKTyoZfbSj7S22c5/KiSMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796085315; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=pe3bK2POPmaAntDlcklDyapugT4/ZMq4N97C37Ve+sY=; b=jPw55uFHJRiWNr+xhtXqeTwYsfNkWad6eWg45jEfSAcVN6GpvDMhTg097fP/wanLYXJM /ePami3Dx/ukbzRaSa8TsNWdhdc6aPBUcREIZwyXcrbGWb5jD2kXh4jFu7Wly0q8pVGAw wNaYkhCy0l5A2crQXP3z1Bn8htZ1FAU4NkQNxAHteTBI2UpgPESwBayLrZDR+vN6aHNuU oHPUlm8eHsudXgTq+aPlQYlzC4QnON0ziguQJJ2tKZhzLU4UX5H0nM6Wz8Oo7NVeO/cN2 ifVeyiPP3P/kYTHvrFrRcaoPQcdqW2NBUnrcrSujsu1U08VYdZJSiNJWVApjtlZjYaw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qqpfaPmW; arc=none smtp.remote-ip=195.10.208.55 Received: from mout-b-110.mailbox.org (mout-b-110.mailbox.org [195.10.208.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12F3E606A337; Tue, 1 Dec 2026 00:35:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 12F3E606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qqpfaPmW Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-110.mailbox.org (Postfix) with ESMTPS id 4jdhk63YP2zNl43; Tue, 01 Dec 2026 01:35:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796085310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pe3bK2POPmaAntDlcklDyapugT4/ZMq4N97C37Ve+sY=; b=qqpfaPmWJBoQVYL69P7utBfFzVBvtTwADxJ9MIywRK4v9Ei4tj9B6bnoum+NhdahRgIrft ddKd4HHLn1LT089QSMTRuvP5LoY0ZaW+4XKL2dMvh9R5Plu9zXuYM9B5BSxy6fvdWTcRD9 enyv6U7CbBfFKOXuf/e+tSITgRzk4WQD2S2hWyL4jd1HaS6cuuoqARivoXW1akPNbh7VJk fPrv1o/y6lXl++l+r0sKEXhqyihBqn7dgg4rEZN0mHDSVagpfLQh3T4RYbhVsIM8RSN52m OoGGlBDNNlxm13j+u0jj4qBqxSM2ehc5ecxm5wTjyRk1N8lv2KuXojQDbfIZOg== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com From: Antonio Quartulli To: Omar Ramadan Cc: Antonio Quartulli , Taehee Yoo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, brett.creeley@amd.com, sgoutham@marvell.com, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, intel-wired-lan@lists.osuosl.org, Ido Schimmel , Satish Kharat , Andrew Lunn , Simon Horman , Shuah Khan , Kees Cook , "Gustavo A. R. Silva" , linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [RFC PATCH net-next 2/9] amt: offload provider registry and lower-device lifecycle Date: Tue, 1 Dec 2026 01:34:49 +0100 Message-ID: <20261201003458.3731956-3-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261107184437.2783174-3-omar@blockcast.net> References: <20261107184437.2783174-1-omar@blockcast.net> <20261107184437.2783174-3-omar@blockcast.net> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4jdhk63YP2zNl43 On Sat, Nov 07, 2026 at 06:44:28PM +0000, Omar Ramadan wrote:=0D > +static int amt_offload_required_refused_set(const char *val,=0D > + const struct kernel_param *kp)=0D > +{=0D > + pr_warn("offload_required_refused is read-only; ignoring \"%s\"\n",=0D > + val ? val : "");=0D > + return 0;=0D > +}=0D =0D netdev doesn't take new module parameters :)=0D And this one is a counter that is global across network namespaces.=0D Please drop it; if the counter is needed, report it through netlink (as=0D discussed in the cover letter).=0D =0D > +static LIST_HEAD(amt_offload_providers);=0D =0D The comment above calls this an RCU list for readers outside RTNL, but=0D there are no such readers: the only lookup asserts RTNL. A plain list=0D is enough, no?=0D =0D > + p->lower =3D lower;=0D > + p->ops =3D ops;=0D > + list_add_rcu(&p->node, &amt_offload_providers);=0D =0D There is no reference on @lower and no reg_state check. A provider that=0D registers too early or too late leaves an entry that can later match a=0D reused pointer. The lookup also matches the relay's stream_dev exactly,=0D so a relay on a VLAN or bond over the capable port can never offload.=0D =0D > + /* 1. Stop admission and wait for every ops->xmit already admitted. */= =0D > + WRITE_ONCE(b->admitting, false);=0D > + synchronize_net();=0D [...]=0D > + RCU_INIT_POINTER(amt->offload, NULL);=0D > + synchronize_rcu();=0D > + kfree(b);=0D =0D This costs two grace periods per relay under RTNL, the second one a=0D plain synchronize_rcu(). Unregistering a provider or a lower that=0D carries N relays therefore costs 2N grace periods under RTNL. After the=0D first grace period no reader is inside xmit; later readers only need b=0D to stay allocated, so kfree_rcu() can replace the second one. Clearing=0D admitting on all relays first and waiting once would remove the=0D remaining N-1.=0D =0D > + err =3D amt_offload_attach(amt, extack);=0D > + if (err) {=0D > + netdev_upper_dev_unlink(amt->stream_dev, dev);=0D > + unregister_netdevice(dev);=0D > + goto err;=0D > + }=0D =0D A refused required-mode relay is registered and then unregistered, so=0D userspace sees RTM_NEWLINK and RTM_DELLINK for a link whose creation=0D failed. The provider lookup needs only stream_dev; please do it before=0D register_netdevice().=0D =0D > +static const struct attribute_group amt_offload_group =3D {=0D > + .name =3D "offload",=0D > + .attrs =3D amt_offload_attrs,=0D > +};=0D =0D New per-netdev sysfs won't be accepted (as per the cover letter comment).=0D Also, this group is in amt_groups, so it shows up on gateway-mode devices=0D too.=0D =0D > +static int __maybe_unused amt_offload_track(struct list_head *list,=0D > + void *handle)=0D =0D Patch 3 deletes this helper, struct amt_offload_ref and the two lists.=0D Please don't add code that the next patch removes :)=0D =0D Regards,=0D Antonio=0D