mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qiliang Yuan <qiliang.yuan@linux.dev>
To: Ralf Lici <ralf@mandelbit.com>
Cc: Qiliang Yuan <qiliang.yuan@linux.dev>,
	davem@davemloft.net, dsahern@kernel.org, edumazet@kernel.org,
	horms@kernel.org, idosch@nvidia.com, kuba@kernel.org,
	kuniyu@google.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com, razor@blackwall.org
Subject: Re: [PATCH net-next v4 2/4] ipv6: take fib6_sernum from a sequence shared by all netns
Date: Fri, 20 Nov 2026 18:13:53 -0500	[thread overview]
Message-ID: <20261120231353.4189980-1-qiliang.yuan@linux.dev> (raw)
In-Reply-To: <20261120175241.289834-1-ralf@mandelbit.com>

Hi Ralf,

On Fri, Nov 20, 2026 at 06:52:41PM +0100, Ralf Lici wrote:
> What the atomic_set
> changes is the ordering. It comes after the full barrier of the cmpxchg,
> so nothing orders it before the node stamp in fib6_update_sernum: a
> reader can sample the new fn_sernum while still reading the old
> generation (this one is allowed on arm64).
[...]
> The late store also loses the guarantee that a reader seeing a value
> sees the routing changes published before it.
[...]
> Drawing from the shared sequence but publishing with a cmpxchg on the
> per-netns counter keeps both, at the cost of a wasted draw on
> contention:

Thanks for the careful review. I wrote both cases as litmus tests and
herd7 agrees: the stale generation and the late store of a smaller
value are both reachable with atomic_set() and forbidden once the
value is published with atomic_try_cmpxchg() on the per-netns counter.

> 1/4 has the same pattern for rt_genid, and IPv4 bumps can run
> concurrently too, since xfrm policy insertion does not hold RTNL.

Right. I'll publish with a cmpxchg in both 1/4 and 2/4 in v5, as you
suggested, and Cc you on it.

Thanks,
Qiliang

  reply	other threads:[~2026-11-20 23:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  2:28 [PATCH net-next v4 0/4] net: make moving a device to another netns cheaper Qiliang Yuan
2026-11-18  2:28 ` [PATCH net-next v4 1/4] ipv4: draw rt_genid from a sequence shared by all netns Qiliang Yuan
2026-11-18  2:28 ` [PATCH net-next v4 2/4] ipv6: take fib6_sernum " Qiliang Yuan
2026-11-20 17:52   ` Ralf Lici
2026-11-20 23:13     ` Qiliang Yuan [this message]
2026-11-18  2:28 ` [PATCH net-next v4 3/4] nexthop: release cached routes when a nexthop leaves a group Qiliang Yuan
2026-11-18  2:28 ` [PATCH net-next v4 4/4] net: remove rcu_barrier() from __dev_change_net_namespace() Qiliang Yuan

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

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

  git send-email \
    --in-reply-to=20261120231353.4189980-1-qiliang.yuan@linux.dev \
    --to=qiliang.yuan@linux.dev \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@mandelbit.com \
    --cc=razor@blackwall.org \
    /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

all inboxes | Powered by JetHome®