]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: xrs700x: Use irqsave variant for u64 stats update
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 25 Aug 2022 11:36:44 +0000 (13:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Aug 2022 12:02:26 +0000 (13:02 +0100)
commit1f7ce64ef7828fd574835f86d2e0a66c7180818d
treebf7550925227acac89bd5810c751976bfcd9fe3d
parent6e344bde8b8cb92dcce3b03ca62c6a994e532224
net: dsa: xrs700x: Use irqsave variant for u64 stats update

xrs700x_read_port_counters() updates the stats from a worker using the
u64_stats_update_begin() version. This is okay on 32-UP since on the
reader side preemption is disabled.
On 32bit-SMP the writer can be preempted by the reader at which point
the reader will spin on the seqcount until writer continues and
completes the update.

Assigning the mib_mutex mutex to the underlying seqcount would ensure
proper synchronisation. The API for that on the u64_stats_init() side
isn't available. Since it is the only user, just use disable interrupts
during the update.

Use u64_stats_update_begin_irqsave() on the writer side to ensure an
uninterrupted update.

Fixes: 78de80e7c4bd8 ("net: dsa: add Arrow SpeedChips XRS700x driver")
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: George McCollister <george.mccollister@gmail.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/xrs700x/xrs700x.c