netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: u64_stats fixups for 32bit.
@ 2022-08-25 11:36 Sebastian Andrzej Siewior
  2022-08-25 11:36 ` [PATCH net 1/2] net: dsa: xrs700x: Use irqsave variant for u64 stats update Sebastian Andrzej Siewior
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-08-25 11:36 UTC (permalink / raw)
  To: netdev; +Cc: Jakub Kicinski, David S. Miller, Thomas Gleixner, Peter Zijlstra

Hi,

while looking at the u64-stats patch
	https://lore.kernel.org/all/20220817162703.728679-10-bigeasy@linutronix.de

I noticed that u64_stats_fetch_begin() is used. That suspicious thing
about it is that network processing, including stats update, is
performed in NAPI and so I would expect to see
u64_stats_fetch_begin_irq() in order to avoid updates from NAPI during
the read. This is only needed on 32bit-UP where the seqcount is not
used. This is address in 2/2. The remaining user take some kind of
precaution and may use u64_stats_fetch_begin().

I updated the previously mentioned patch to get rid of
u64_stats_fetch_begin_irq(). If this is not considered stable patch
worthy then it can be ignored and considred fixed by the other series
which removes the special 32bit cases.

The xrs700x driver reads and writes the counter from preemptible context
so the only missing piece here is at least disable preemption on the
writer side to avoid preemption while the writer is in progress. The
possible reader would spin then until the writer completes its write
critical section which is considered bad. This is addressed in 1/2 by
using u64_stats_update_begin_irqsave() and so disable interrupts during
the write critical section.
The other closet resemblance I found is mdio_bus.c::mdiobus_stats_acct()
where preemtion is disabled unconditionally. This is something I want to
avoid since it also affects 64bit.

Sebastian



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-29 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 11:36 [PATCH net 0/2] net: u64_stats fixups for 32bit Sebastian Andrzej Siewior
2022-08-25 11:36 ` [PATCH net 1/2] net: dsa: xrs700x: Use irqsave variant for u64 stats update Sebastian Andrzej Siewior
2022-08-25 11:51   ` George McCollister
2022-08-25 11:36 ` [PATCH net 2/2] net: Use u64_stats_fetch_begin_irq() for stats fetch Sebastian Andrzej Siewior
2022-08-29  9:55   ` Simon Horman
2022-08-29 12:10 ` [PATCH net 0/2] net: u64_stats fixups for 32bit patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).