linux/drivers
Florian Fainelli 7095c97345 net: systemport: Fix 64-bit stats deadlock
We can enter a deadlock situation because there is no sufficient protection
when ndo_get_stats64() runs in process context to guard against RX or TX NAPI
contexts running in softirq, this can lead to the following lockdep splat and
actual deadlock was experienced as well with an iperf session in the background
and a while loop doing ifconfig + ethtool.

[    5.780350] ================================
[    5.784679] WARNING: inconsistent lock state
[    5.789011] 4.13.0-rc7-02179-g32fae27c725d #70 Not tainted
[    5.794561] --------------------------------
[    5.798890] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[    5.804971] swapper/0/0 [HC0[0]:SC1[1]:HE0:SE0] takes:
[    5.810175]  (&syncp->seq#2){+.?...}, at: [<c0768a28>] bcm_sysport_tx_reclaim+0x30/0x54
[    5.818327] {SOFTIRQ-ON-W} state was registered at:
[    5.823278]   bcm_sysport_get_stats64+0x17c/0x258
[    5.828053]   dev_get_stats+0x38/0xac
[    5.831776]   rtnl_fill_stats+0x30/0x118
[    5.835761]   rtnl_fill_ifinfo+0x538/0xe24
[    5.839921]   rtmsg_ifinfo_build_skb+0x6c/0xd8
[    5.844430]   rtmsg_ifinfo_event.part.5+0x14/0x44
[    5.849201]   rtmsg_ifinfo+0x20/0x28
[    5.852837]   register_netdevice+0x628/0x6b8
[    5.857171]   register_netdev+0x14/0x24
[    5.861051]   bcm_sysport_probe+0x30c/0x438
[    5.865280]   platform_drv_probe+0x50/0xb0
[    5.869418]   driver_probe_device+0x2e8/0x450
[    5.873817]   __driver_attach+0x104/0x120
[    5.877871]   bus_for_each_dev+0x7c/0xc0
[    5.881834]   bus_add_driver+0x1b0/0x270
[    5.885797]   driver_register+0x78/0xf4
[    5.889675]   do_one_initcall+0x54/0x190
[    5.893646]   kernel_init_freeable+0x144/0x1d0
[    5.898135]   kernel_init+0x8/0x110
[    5.901665]   ret_from_fork+0x14/0x2c
[    5.905363] irq event stamp: 24263
[    5.908804] hardirqs last  enabled at (24262): [<c08eecf0>] net_rx_action+0xc4/0x4e4
[    5.916624] hardirqs last disabled at (24263): [<c0a7da00>] _raw_spin_lock_irqsave+0x1c/0x98
[    5.925143] softirqs last  enabled at (24258): [<c022a7fc>] irq_enter+0x84/0x98
[    5.932524] softirqs last disabled at (24259): [<c022a918>] irq_exit+0x108/0x16c
[    5.939985]
[    5.939985] other info that might help us debug this:
[    5.946576]  Possible unsafe locking scenario:
[    5.946576]
[    5.952556]        CPU0
[    5.955031]        ----
[    5.957506]   lock(&syncp->seq#2);
[    5.960955]   <Interrupt>
[    5.963604]     lock(&syncp->seq#2);
[    5.967227]
[    5.967227]  *** DEADLOCK ***
[    5.967227]
[    5.973222] 1 lock held by swapper/0/0:
[    5.977092]  #0:  (&(&ring->lock)->rlock){..-...}, at: [<c0768a18>] bcm_sysport_tx_reclaim+0x20/0x54

So just remove the u64_stats_update_begin()/end() pair in ndo_get_stats64()
since it does not appear to be useful for anything. No inconsistency was
observed with either ifconfig or ethtool, global TX counts equal the sum of
per-queue TX counts on a 32-bit architecture.

Fixes: 10377ba767 ("net: systemport: Support 64bit statistics")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-15 14:24:10 -07:00
..
accessibility
acpi Device properties framework updates for v4.14-rc1 2017-09-05 12:50:00 -07:00
amba
android ANDROID: binder: don't queue async transactions to thread. 2017-09-01 09:22:50 +02:00
ata Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2017-09-06 22:41:21 -07:00
atm
auxdisplay
base treewide: make "nr_cpu_ids" unsigned 2017-09-08 18:26:48 -07:00
bcma
block Merge branch 'for-4.14/block-postmerge' of git://git.kernel.dk/linux-block 2017-09-09 12:49:01 -07:00
bluetooth
bus
cdrom
char Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-09-06 15:17:17 -07:00
clk clk: sunxi-ng: Provide a default reset hook 2017-08-30 15:03:52 +02:00
clocksource Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 13:06:34 -07:00
connector
cpufreq ACPI updates for v4.14-rc1 2017-09-05 12:45:03 -07:00
cpuidle Power management updates for v4.14-rc1 2017-09-05 12:19:08 -07:00
crypto dmaengine updates for 4.14-rc1 2017-09-07 14:03:05 -07:00
dax
dca
devfreq PM / devfreq: Fix memory leak when fail to register device 2017-08-28 10:31:08 +09:00
dio
dma dmaengine updates for 4.14-rc1 2017-09-07 14:03:05 -07:00
dma-buf
edac
eisa
extcon
firewire
firmware Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:42:35 -07:00
fmc drivers/fmc: carrier can program FPGA on registration 2017-08-28 16:24:22 +02:00
fpga
fsi drivers/fsi/scom: Remove reset before every putscom 2017-08-28 17:15:16 +02:00
gpio - New Drivers 2017-09-07 13:51:13 -07:00
gpu lib/interval_tree: fast overlap detection 2017-09-08 18:26:49 -07:00
hid media updates for v4.14-rc1 2017-09-07 12:53:14 -07:00
hsi
hv Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:25:15 -07:00
hwmon Merge branches 'ib-mfd-arm-i2c-4.14', 'ib-mfd-arm-usb-video-4.14', 'ib-mfd-hwmon-4.14', 'ib-mfd-iio-pwm-4.14', 'ib-mfd-input-rtc-4.14', 'ib-mfd-many-4.14' and 'ib-mfd-pinctrl-regulator-4.14' into ibs-for-mfd-merged 2017-09-05 08:45:36 +01:00
hwspinlock
hwtracing stm class / intel_th: Updates for 4.14 2017-08-28 16:58:19 +02:00
i2c i2c: designware: Round down ACPI provided clk to nearest supported clk 2017-08-31 20:27:39 +02:00
ide Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block 2017-09-07 11:59:42 -07:00
idle Power management updates for v4.14-rc1 2017-09-05 12:19:08 -07:00
iio - New Drivers 2017-09-07 13:51:13 -07:00
infiniband More RDMA work and some op-structure constification from Chuck Lever, 2017-09-09 13:31:49 -07:00
input - New Drivers 2017-09-07 13:51:13 -07:00
iommu pci-v4.14-changes 2017-09-08 15:47:43 -07:00
ipack
irqchip Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 13:08:27 -07:00
isdn isdn: isdnloop: fix logic error in isdnloop_sendbuf 2017-09-07 20:03:54 -07:00
leds LED updates for 4.14 2017-09-07 14:33:13 -07:00
lightnvm
macintosh powerpc/macintosh: constify wf_sensor_ops structures 2017-09-01 16:42:54 +10:00
mailbox Just behavorial changes to a controller driver: 2017-09-07 13:23:37 -07:00
mcb Char/Misc drivers for 4.14-rc1 2017-09-05 11:08:17 -07:00
md Merge branch 'for-4.14/block-postmerge' of git://git.kernel.dk/linux-block 2017-09-09 12:49:01 -07:00
media media updates for v4.14-rc1 2017-09-07 12:53:14 -07:00
memory mfd: syscon: atmel-smc: Add helper to retrieve register layout 2017-09-05 08:46:01 +01:00
memstick
message scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough 2017-08-29 21:51:45 -04:00
mfd - New Drivers 2017-09-07 13:51:13 -07:00
misc pci-v4.14-changes 2017-09-08 15:47:43 -07:00
mmc mmc: renesas_sdhi: Add r8a7743/5 support 2017-09-01 15:31:01 +02:00
mtd linux/kernel.h: move DIV_ROUND_DOWN_ULL() macro 2017-09-08 18:26:47 -07:00
mux mux: make device_type const 2017-08-29 13:46:35 +02:00
net net: systemport: Fix 64-bit stats deadlock 2017-09-15 14:24:10 -07:00
nfc
ntb
nubus
nvdimm Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block 2017-09-07 11:59:42 -07:00
nvme Merge branch 'for-4.14/block-postmerge' of git://git.kernel.dk/linux-block 2017-09-09 12:49:01 -07:00
nvmem nvmem: core: remove unneeded NULL check 2017-08-28 17:33:23 +02:00
of DeviceTree updates for 4.14: 2017-09-07 14:43:33 -07:00
oprofile
parisc
parport Char/Misc drivers for 4.14-rc1 2017-09-05 11:08:17 -07:00
pci pci-v4.14-changes 2017-09-08 15:47:43 -07:00
pcmcia
perf
phy pci-v4.14-changes 2017-09-08 15:47:43 -07:00
pinctrl - New Drivers 2017-09-07 13:51:13 -07:00
platform platform-drivers-x86 for v4.14-1 2017-09-08 16:04:50 -07:00
pnp
power - New Drivers 2017-09-07 13:51:13 -07:00
powercap
pps drivers/pps: use surrounding "if PPS" to remove numerous dependency checks 2017-09-08 18:26:51 -07:00
ps3
ptp
pwm Merge branches 'ib-mfd-arm-i2c-4.14', 'ib-mfd-arm-usb-video-4.14', 'ib-mfd-hwmon-4.14', 'ib-mfd-iio-pwm-4.14', 'ib-mfd-input-rtc-4.14', 'ib-mfd-many-4.14' and 'ib-mfd-pinctrl-regulator-4.14' into ibs-for-mfd-merged 2017-09-05 08:45:36 +01:00
rapidio
ras
regulator - New Drivers 2017-09-07 13:51:13 -07:00
remoteproc
reset
rpmsg
rtc Merge branches 'ib-mfd-arm-i2c-4.14', 'ib-mfd-arm-usb-video-4.14', 'ib-mfd-hwmon-4.14', 'ib-mfd-iio-pwm-4.14', 'ib-mfd-input-rtc-4.14', 'ib-mfd-many-4.14' and 'ib-mfd-pinctrl-regulator-4.14' into ibs-for-mfd-merged 2017-09-05 08:45:36 +01:00
s390 SCSI misc on 20170907 2017-09-07 21:11:05 -07:00
sbus
scsi treewide: make "nr_cpu_ids" unsigned 2017-09-08 18:26:48 -07:00
sfi
sh
sn
soc
spi ACPI updates for v4.14-rc1 2017-09-05 12:45:03 -07:00
spmi spmi: pmic-arb: Move the ownership check to irq_chip callback 2017-08-28 13:52:22 +02:00
ssb
staging SCSI misc on 20170907 2017-09-07 21:11:05 -07:00
target Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block 2017-09-07 11:59:42 -07:00
tc
tee
thermal
thunderbolt ACPI updates for v4.14-rc1 2017-09-05 12:45:03 -07:00
tty powerpc updates for 4.14 2017-09-07 10:15:40 -07:00
uio
usb SCSI misc on 20170907 2017-09-07 21:11:05 -07:00
uwb
vfio
vhost lib/interval_tree: fast overlap detection 2017-09-08 18:26:49 -07:00
video - Fix-ups 2017-09-07 13:55:16 -07:00
virt virt: Convert to using %pOF instead of full_name 2017-08-29 08:52:51 -05:00
virtio SCSI misc on 20170907 2017-09-07 21:11:05 -07:00
vlynq
vme
w1 drivers: w1: add hwmon temp support for w1_therm 2017-08-31 18:50:14 +02:00
watchdog mfd: twl: Move header file out of I2C realm 2017-09-04 14:41:02 +01:00
xen xen: fixes and features for 4.14 2017-09-07 10:24:21 -07:00
zorro
Kconfig
Makefile