linux-kernelorg-stable/drivers/net/ethernet
Petr Tesarik 38cc3c6dcc net: stmmac: protect updates of 64-bit statistics counters
As explained by a comment in <linux/u64_stats_sync.h>, write side of struct
u64_stats_sync must ensure mutual exclusion, or one seqcount update could
be lost on 32-bit platforms, thus blocking readers forever. Such lockups
have been observed in real world after stmmac_xmit() on one CPU raced with
stmmac_napi_poll_tx() on another CPU.

To fix the issue without introducing a new lock, split the statics into
three parts:

1. fields updated only under the tx queue lock,
2. fields updated only during NAPI poll,
3. fields updated only from interrupt context,

Updates to fields in the first two groups are already serialized through
other locks. It is sufficient to split the existing struct u64_stats_sync
so that each group has its own.

Note that tx_set_ic_bit is updated from both contexts. Split this counter
so that each context gets its own, and calculate their sum to get the total
value in stmmac_get_ethtool_stats().

For the third group, multiple interrupts may be processed by different CPUs
at the same time, but interrupts on the same CPU will not nest. Move fields
from this group to a newly created per-cpu struct stmmac_pcpu_stats.

Fixes: 133466c3bb ("net: stmmac: use per-queue 64 bit statistics where necessary")
Link: https://lore.kernel.org/netdev/Za173PhviYg-1qIn@torres.zugschlus.de/t/
Cc: stable@vger.kernel.org
Signed-off-by: Petr Tesarik <petr@tesarici.cz>
Reviewed-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2024-02-07 09:00:34 +00:00
..
3com
8390 net: fill in MODULE_DESCRIPTION()s for 8390 2024-01-24 15:12:20 -08:00
actions
adaptec
adi
aeroflex
agere
alacritech
allwinner
alteon
altera
amazon net: ena: Take xdp packets stats into account in ena_get_stats64() 2024-01-03 18:00:58 -08:00
amd pds_core: Rework teardown/setup flow to be more common 2024-01-31 18:26:59 -08:00
apm
apple
aquantia net: atlantic: Fix DMA mapping for PTP hwts ring 2024-02-02 20:47:05 -08:00
arc
asix
atheros
broadcom bnxt_en: Make PTP timestamp HWRM more silent 2024-01-26 14:06:21 -08:00
brocade
cadence
calxeda
cavium net: fill in MODULE_DESCRIPTION()s for liquidio 2024-01-24 15:12:20 -08:00
chelsio
cirrus net: fill in MODULE_DESCRIPTION()s for ep93xxx_eth 2024-01-24 15:12:20 -08:00
cisco
cortina net: ethernet: cortina: Drop TSO support 2024-01-07 16:05:00 +00:00
davicom
dec
dlink
emulex
engleder tsnep: Fix mapping for zero copy XDP_TX action 2024-02-03 12:40:02 +00:00
ezchip net: fill in MODULE_DESCRIPTION()s for nps_enet 2024-01-24 15:12:20 -08:00
faraday
freescale net: fec: fix the unhandled context fault from smmu 2024-01-25 11:22:27 +01:00
fujitsu
fungible
google gve: Fix skb truesize underestimation 2024-01-25 17:08:34 -08:00
hisilicon Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
huawei
i825xx
ibm mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER 2024-01-08 15:27:15 -08:00
intel idpf: avoid compiler padding in virtchnl2_ptype struct 2024-02-01 09:10:41 -08:00
litex net: fill in MODULE_DESCRIPTION()s for litex 2024-01-24 15:12:21 -08:00
marvell octeontx2-pf: Fix a memleak otx2_sq_init 2024-02-03 12:48:20 +00:00
mediatek net: ethernet: mtk_eth_soc: set DMA coherent mask to get PPE working 2024-01-25 17:20:12 -08:00
mellanox net/mlx5e: fix a potential double-free in fs_any_create_groups 2024-01-24 00:15:38 -08:00
micrel spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
microchip net: lan966x: Fix port configuration when using SGMII interface 2024-01-27 10:02:01 +00:00
microsoft RDMA v6.8 merge window 2024-01-12 13:52:21 -08:00
moxa
mscc
myricom
natsemi
neterion net: fill in MODULE_DESCRIPTION()s for s2io 2024-01-11 16:16:08 -08:00
netronome nfp: enable NETDEV_XDP_ACT_REDIRECT feature flag 2024-02-05 11:11:09 +00:00
ni
nvidia
nxp
oki-semi
packetengines
pasemi
pensando
qlogic Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
qualcomm Including fixes from bpf and netfilter. 2024-01-18 17:33:50 -08:00
rdc
realtek Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
renesas net: ravb: Fix dma_addr_t truncation in error case 2024-01-14 16:41:51 +00:00
rocker
samsung
seeq
sfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
sgi
silan
sis
smsc
socionext
stmicro net: stmmac: protect updates of 64-bit statistics counters 2024-02-07 09:00:34 +00:00
sun
sunplus
synopsys
tehuti
ti net: ethernet: ti: am65-cpsw: Fix max mtu to fit ethernet frames 2024-01-11 16:54:45 -08:00
toshiba Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
tundra
vertexcom
via
wangxun net: fill in MODULE_DESCRIPTION()s for wx_lib 2024-01-12 12:17:37 +00:00
wiznet
xilinx
xircom
xscale
Kconfig
Makefile
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c
jme.h
korina.c
lantiq_etop.c
lantiq_xrx200.c