]> git.ipfire.org Git - thirdparty/linux.git/commit
netdevsim: psp: use atomic64 for psp stats counters
authorDaniel Zahka <daniel.zahka@gmail.com>
Fri, 29 May 2026 13:15:28 +0000 (06:15 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 2 Jun 2026 19:57:46 +0000 (12:57 -0700)
commit163bea8010bdf785b6dadeab0cb199e94e1f99bd
treecc1c43358e02b8f955e15d8ce9b11768c5fb267e
parentabaef7e966fdc236ee57ea30c019365110d00f48
netdevsim: psp: use atomic64 for psp stats counters

The existing u64_stats_t-based psp counters had two preexisting api
usage bugs: u64_stats_init() was never called on the syncp object, and
the writer side of the u64_stats_update_begin()/end() api was not
serialized. Switch the counters to atomic64_t instead. Atomics need
no initialization and are inherently safe against concurrent writers,
eliminating both bugs at once.

Use atomic64_t rather than atomic_long_t so byte counters don't wrap
at 4 GiB on 32-bit builds.

Fixes: 178f0763c5f3 ("netdevsim: implement psp device stats")
Cc: <stable+noautosel@kernel.org> # netdevsim is a test harness, it's never loaded on production systems
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
Link: https://patch.msgid.link/20260529-fix-psp-stats-v2-2-3a194eacf18e@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netdevsim/netdevsim.h
drivers/net/netdevsim/psp.c