From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796085317; b=E8H6dKB3Co4xplg+aRa5Ybzf1wLEoj59FPYv0929M600oNNWYuOmBdYjB785uWJCTkzZ DVFf7jtZ09mFQ+fpjGY0eSWx5uonUMMtG8juPqB7zGm+gn5Pigs12V0QXb5HaNRkJuO2/ 4wXzuu24Xi5iUcdgIFxhQcIJeDY+hsZcyhqwdY7QVvG6QsCd5y0gifCOEayNjoCl2kcG5 zhPCzEaiUEg1j8mW+uQNwT2oirJC6r09wawIv3OWDmIYIQ7ecvrWTCPwIyFxC7JOf3xfC aX+KD6ffJfpwsIBKKstCSz8tv+SqCUGA4yq3XA9K/gjlY8pRndovgQrHG4fDjYT3ugg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796085317; 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=R9T1/dVs/UwxKMrxg24OYGyLCFJcm+BqdBD+fhcV/r4=; b=MDbdLa8oNLWImJm3+OAk3lk13ECvINKSmn1l1DB0N6gcU30+tjF/7mqVNjmOfn/48FZf iHAXdVZomz1n8pWK7KppYJrBQ8HICiNQLWG9AzSPt2sBdqoNgURvmeIpqlmbuMY+4QN1G M3mvWsfyL6C9nTbwoYRcrCkc96nioHLU+9I5lmk9goi9Ka3zGbKN4oWLBmI3DI4TuaiwS +FV291jaYgrUAYHl4p0dmPeac2NoZKhFKAeoZspmvJIs2KeH7vv82+xde6S+pwoAQ10NQ ljPsBZbd1QxXyPLvlZAFPbutpbFF/BAzli9rvYxKcxvZP2dOFCUpbJeBjYPBr8kORAg== 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=inoBtzuG; arc=none smtp.remote-ip=195.10.208.46 Received: from mout-b-106.mailbox.org (mout-b-106.mailbox.org [195.10.208.46]) (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 B588E606A33D; Tue, 1 Dec 2026 00:35:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B588E606A33D 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=inoBtzuG 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-106.mailbox.org (Postfix) with ESMTPS id 4jdhk40NKhzNlSV; Tue, 01 Dec 2026 01:35:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796085308; 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=R9T1/dVs/UwxKMrxg24OYGyLCFJcm+BqdBD+fhcV/r4=; b=inoBtzuGbRvFuAkQn/vuU+31r/jFOTGtHP/4TR/lDThWO1g8jfl+V2vfL1BJgPGfdZ9cTD gGNns333j44qDzaysM3Ad1MnvvgllYBDKZIu8okMLrjuGayWUo8rtMerQ6D4/Dtl/K+49/ 2f58y36SE+AQWy1pc92JqoNnezMrxyVIhLKqMBNCGRCNWYDdvrQhcwYSUdVx2K9ptC76KO rRue6UmFC4tB2YPpX8yrMlcmkDLBHZwrVxMj2T9Re/rCPHI4LW2TBayUcypVB0EG14oJYY 24NEat0bZD0zv4qhDQ6hBY43EvJoycNZnr8ALkuwFwRaGZ4wWL/KeQ/4pc3bww== 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 1/9] amt: add the relay replication offload provider header Date: Tue, 1 Dec 2026 01:34:48 +0100 Message-ID: <20261201003458.3731956-2-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261107184437.2783174-2-omar@blockcast.net> References: <20261107184437.2783174-1-omar@blockcast.net> <20261107184437.2783174-2-omar@blockcast.net> X-Mailing-List: netdev@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: 4jdhk40NKhzNlSV On Sat, Nov 07, 2026 at 06:44:28PM +0000, Omar Ramadan wrote:=0D > +/*=0D > + * Reserved: (S,G)-keyed forwarding. v1 forwards per (family, group) exa= ctly=0D > + * as the software path does, so this bit has NO v1 semantics. A provide= r=0D > + * must not set it; amt ignores it.=0D > + */=0D > +#define AMT_OFFLOAD_F_SOURCE_FILTER BIT(0)=0D =0D Please drop everything amt never reads: this bit, caps.features,=0D caps.max_endpoints, caps.max_groups and ops->stats.=0D =0D IMHO it's better to add each one with its first user.=0D =0D > + * @op_timeout_ms: longest a programming op may take before amt treats t= he=0D > + * provider as wedged, resets it and replays from desired state.=0D =0D The ops are synchronous, so amt can only measure an op after it returns.=0D That gets both cases wrong:=0D - An op that hangs is never caught. It keeps amt's offload mutex, and=0D teardown takes that mutex with RTNL held.=0D - An op that succeeds a little late triggers a full flush and replay.=0D =0D Details are in 3/9. Please drop the field: a provider that can time out=0D its command channel returns -ETIMEDOUT and should report through its own=0D devlink health reporter.=0D =0D > + * @epoch: monotonic per relay device, bumped on every bind, reset and=0D > + * teardown. A completion carrying an older epoch is stale and ignored.= =0D =0D No op completes asynchronously and no op takes an epoch, so a provider=0D has nothing to compare it against. I think we can actually get rid of=0D this?=0D =0D > + * key returns the existing handle. 0 means accepted and durable, not ye= t=0D > + * forwarding. Process context, never under amt's spinlocks.=0D =0D It seems the locking rule that matters is missing: the programming ops=0D run with amt's offload mutex held and without RTNL, while teardown holds RT= NL=0D (and, for a netdevsim port, the devlink instance lock) and then takes=0D that mutex. A driver whose command path takes RTNL or the devlink lock=0D deadlocks.=0D The header has to forbid that, or amt has to call the ops under RTNL.=0D =0D > + * the commit until the next one. Until amt publishes @gen, any @xmit fo= r=0D > + * @grp carries an earlier generation this provider committed, and a cal= l=0D > + * already in flight may carry any of those or @gen itself; the provider= =0D > + * serves such a generation or declines it. A provider must never emit=0D =0D This forces every provider to keep earlier committed member sets alive=0D for packets in flight. Hardware replicates from its programmed state and=0D has no notion of a per-packet generation.=0D A potentially simpler rule: amt stops handing the group over and waits=0D out in-flight xmit (synchronize_net) before group_commit, and resumes=0D after it returns. The provider then holds one set, and a joining gateway=0D is served by software while the group is reprogrammed instead of getting=0D nothing (see 4/9).=0D =0D > + * @AMT_OFFLOAD_PATH_INGRESS: the provider replicates on ingress and the= =0D > + * host only sees punted packets. Semantics only until a real provider=0D > + * exists; no simulated provider implements it.=0D =0D I think the ingress path can be dropped from this series, because nothing=0D implements it?=0D The punt rule added in 4/9 seems to be dropping legitimate traffic.=0D =0D > + * relay on @lower in software. Caller holds RTNL. A no-op if @lower has= no=0D > + * provider, which is the case after @lower itself was unregistered.=0D =0D A netns move of @lower also sends NETDEV_UNREGISTER, so amt silently=0D forgets the provider. Every provider must then re-register on=0D NETDEV_REGISTER (netdevsim does), and the contract doesn't say so.=0D =0D An ops pointer in net_device should avoid the problem entirely (see 0/9).=0D =0D Patch 3 rewrites this header (+66/-8) and patch 4 does it again=0D (+35/-3). Please introduce it together with its first user.=0D =0D Regards,=0D Antonio=0D