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