linux_dsm_epyc7002/drivers
Lorenzo Bianconi 1669724f70 mt76: dma: fix possible deadlock running mt76_dma_cleanup
[ Upstream commit 5f0ce5848733b86deaba1c6d102e20479230b20a ]

Fix the following possible deadlock reported by lockdep disabling BH
running mt76_free_pending_txwi()

================================
WARNING: inconsistent lock state
5.9.0-rc6 #14 Not tainted
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
rmmod/1227 [HC0[0]:SC0[0]:HE1:SE1] takes:
ffff888156a83530 (&dev->lock#2){+.?.}-{2:2}, at: mt76_dma_cleanup+0x125/0x150 [mt76]
{IN-SOFTIRQ-W} state was registered at:
  __lock_acquire+0x20c/0x6b0
  lock_acquire+0x9d/0x220
  _raw_spin_lock+0x2c/0x70
  mt76_dma_tx_cleanup+0xc7/0x200 [mt76]
  mt76x02_poll_tx+0x31/0xb0 [mt76x02_lib]
  napi_poll+0x3a/0x100
  net_rx_action+0xa8/0x200
  __do_softirq+0xc4/0x430
  asm_call_on_stack+0xf/0x20
  do_softirq_own_stack+0x49/0x60
  irq_exit_rcu+0x9a/0xd0
  common_interrupt+0xa4/0x190
  asm_common_interrupt+0x1e/0x40
irq event stamp: 9915
hardirqs last  enabled at (9915): [<ffffffff8124e286>] __free_pages_ok+0x336/0x3b0
hardirqs last disabled at (9914): [<ffffffff8124e24e>] __free_pages_ok+0x2fe/0x3b0
softirqs last  enabled at (9912): [<ffffffffa03aa672>] mt76_dma_rx_cleanup+0xa2/0x120 [mt76]
softirqs last disabled at (9846): [<ffffffffa03aa5ea>] mt76_dma_rx_cleanup+0x1a/0x120 [mt76]

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&dev->lock#2);
  <Interrupt>
    lock(&dev->lock#2);

 *** DEADLOCK ***

1 lock held by rmmod/1227:
 #0: ffff88815b5eb240 (&dev->mutex){....}-{3:3}, at: driver_detach+0xb5/0x110

stack backtrace:
CPU: 1 PID: 1227 Comm: rmmod Kdump: loaded Not tainted 5.9.0-rc6-wdn-src+ #14
Hardware name: Dell Inc. Studio XPS 1340/0K183D, BIOS A11 09/08/2009
Call Trace:
 dump_stack+0x77/0xa0
 mark_lock_irq.cold+0x15/0x39
 mark_lock+0x1fc/0x500
 mark_usage+0xc7/0x140
 __lock_acquire+0x20c/0x6b0
 ? find_held_lock+0x2b/0x80
 ? sched_clock_cpu+0xc/0xb0
 lock_acquire+0x9d/0x220
 ? mt76_dma_cleanup+0x125/0x150 [mt76]
 _raw_spin_lock+0x2c/0x70
 ? mt76_dma_cleanup+0x125/0x150 [mt76]
 mt76_dma_cleanup+0x125/0x150 [mt76]
 mt76x2_cleanup+0x5a/0x70 [mt76x2e]
 mt76x2e_remove+0x18/0x30 [mt76x2e]
 pci_device_remove+0x36/0xa0
 __device_release_driver+0x16c/0x220
 driver_detach+0xcf/0x110
 bus_remove_driver+0x56/0xca
 pci_unregister_driver+0x36/0x80
 __do_sys_delete_module.constprop.0+0x127/0x200
 ? syscall_enter_from_user_mode+0x1d/0x50
 ? trace_hardirqs_on+0x1c/0xe0
 do_syscall_64+0x33/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7ff0da54e36b
Code: 73 01 c3 48 8b 0d 2d 0b 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fd 0a 0c 00 f7 d8 64 89 01 48

Fixes: dd57a95cfd ("mt76: move txwi handling code to dma.c, since it is mmio specific")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-30 11:53:35 +01:00
..
accessibility speakup: Reject setting the speakup line discipline outside of speakup 2020-11-30 09:20:32 +01:00
acpi arm64 fixes for -rc6 2020-11-27 10:44:59 -08:00
amba
android
ata libata-5.10-2020-10-30 2020-10-30 14:51:01 -07:00
atm atm: nicstar: Unmap DMA on send error 2020-11-18 16:42:07 -08:00
auxdisplay
base PM: runtime: Resume the device earlier in __device_release_driver() 2020-11-02 18:14:07 +01:00
bcma
block xen: add helpers for caching grant mapping pages 2020-12-09 10:31:37 +01:00
bluetooth Bluetooth: hci_h5: fix memory leak in h5_close 2020-12-30 11:53:05 +01:00
bus mips: cdmm: fix use-after-free in mips_cdmm_bus_discover 2020-12-30 11:53:24 +01:00
cdrom
char Char/Misc driver fixes for 5.10-rc4 2020-11-15 10:15:17 -08:00
clk clk: meson: Kconfig: fix dependency for G12A 2020-12-30 11:53:19 +01:00
clocksource clocksource/drivers/riscv: Make RISCV_TIMER depends on RISCV_SBI 2020-12-30 11:53:33 +01:00
connector
counter counter/ti-eqep: Fix regmap max_register 2020-11-01 17:17:31 +00:00
cpufreq Merge branch 'cpufreq/arm/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-11-23 12:55:01 +01:00
cpuidle cpuidle: tegra: Annotate tegra_pm_set_cpu_in_lp2() with RCU_NONIDLE 2020-11-16 13:24:32 +01:00
crypto crypto: sun8i-ce - fix two error path's memory leak 2020-12-30 11:53:17 +01:00
dax mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports 2020-11-22 10:48:22 -08:00
dca
devfreq
dio
dma dmaengine: mv_xor_v2: Fix error return code in mv_xor_v2_probe() 2020-12-30 11:53:21 +01:00
dma-buf
edac EDAC/mce_amd: Use struct cpuinfo_x86.cpu_die_id for AMD NodeId 2020-12-30 11:53:16 +01:00
eisa
extcon
firewire
firmware firmware: arm_scmi: Fix missing destroy_workqueue() 2020-12-30 11:53:09 +01:00
fpga fpga: Specify HAS_IOMEM dependency for FPGA_DFL 2020-12-01 18:46:24 +01:00
fsi
gnss
gpio gpio: eic-sprd: break loop when getting NULL device resource 2020-12-09 09:41:49 +01:00
gpu drm/mediatek: Use correct aliases name for ovl 2020-12-30 11:53:24 +01:00
greybus
hid HID: i2c-hid: add Vero K147 to descriptor override 2020-12-26 16:02:43 +01:00
hsi HSI: omap_ssi: Don't jump to free ID in ssi_add_controller() 2020-12-30 11:53:24 +01:00
hv hyperv-fixes for 5.10-rc5 2020-11-16 15:02:33 -08:00
hwmon hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable 2020-12-30 11:53:31 +01:00
hwspinlock
hwtracing coresight: etm4x: Handle TRCVIPCSSCTLR accesses 2020-12-26 16:02:42 +01:00
i2c Revert "i2c: i2c-qcom-geni: Fix DMA transfer race" 2020-12-30 11:52:57 +01:00
i3c
ide
idle intel_idle: Build fix 2020-12-03 10:00:23 +01:00
iio iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context 2020-12-30 11:53:33 +01:00
infiniband RDMA/hns: Bugfix for calculation of extended sge 2020-12-30 11:53:28 +01:00
input Input: omap4-keypad - fix runtime PM error handling 2020-12-30 11:53:19 +01:00
interconnect interconnect: fix memory trashing in of_count_icc_providers() 2020-11-20 16:01:35 +02:00
iommu iommu/vt-d: include conditionally on CONFIG_INTEL_IOMMU_SVM 2020-12-30 11:53:14 +01:00
ipack
irqchip irqchip fixes for Linux 5.10, take #2 2020-11-25 00:56:28 +01:00
isdn
leds leds: turris-omnia: check for LED_COLOR_ID_RGB instead LED_COLOR_ID_MULTI 2020-12-30 11:53:22 +01:00
lightnvm
macintosh
mailbox mailbox: arm_mhu_db: Fix mhu_db_shutdown by replacing kfree with devm_kfree 2020-12-30 11:53:28 +01:00
mcb
md md: fix a warning caused by a race between concurrent md_ioctl()s 2020-12-26 16:02:45 +01:00
media media: saa7146: fix array overflow in vidioc_s_audio() 2020-12-30 11:53:31 +01:00
memory ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
memstick memstick: r592: Fix error return in r592_probe() 2020-12-30 11:53:34 +01:00
message scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() 2020-10-26 16:57:18 -04:00
mfd mfd: cpcap: Fix interrupt regression with regmap clear_ack 2020-12-30 11:53:16 +01:00
misc at24 fixes for v5.10 2020-12-11 23:23:30 +01:00
mmc mmc: pxamci: Fix error return code in pxamci_probe 2020-12-30 11:53:20 +01:00
most
mtd mtd: rawnand: xway: Do not force a particular software ECC engine 2020-12-11 20:10:02 +01:00
mux
net mt76: dma: fix possible deadlock running mt76_dma_cleanup 2020-12-30 11:53:35 +01:00
nfc nfc: s3fwrn5: use signed integer for parsing GPIO numbers 2020-11-24 15:00:53 -08:00
ntb Bug fixes for v5.10 2020-10-25 11:12:31 -07:00
nubus
nvdimm
nvme nvme: fix memory leak freeing command effects 2020-11-14 09:57:55 +01:00
nvmem
of of/address: Fix of_node memory leak in of_dma_is_coherent 2020-11-11 17:10:16 -06:00
opp opp: Reduce the size of critical section in _opp_table_kref_release() 2020-10-27 13:21:03 +05:30
oprofile
parisc
parport
pci PCI: iproc: Invalidate correct PAXB inbound windows 2020-12-30 11:53:27 +01:00
pcmcia
perf
phy phy: tegra: xusb: Fix usb_phy device driver field 2020-12-30 11:53:26 +01:00
pinctrl pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() 2020-12-30 11:53:34 +01:00
platform platform/x86: dell-smbios-base: Fix error return code in dell_smbios_init 2020-12-30 11:53:28 +01:00
pnp PNP: fix kernel-doc markups 2020-10-27 19:23:04 +01:00
power power: supply: bq24190_charger: fix reference leak 2020-12-30 11:53:25 +01:00
powercap Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2020-11-10 10:02:31 -08:00
pps
ps3
ptp ptp: clockmatrix: bug fix for idtcm_strverscmp 2020-11-25 17:24:49 -08:00
pwm pwm: sl28cpld: fix getting driver data in pwm callbacks 2020-12-03 09:57:37 -08:00
rapidio
ras
regulator regulator: ti-abb: Fix array out of bound read access on the first transition 2020-11-18 17:59:24 +00:00
remoteproc remoteproc updates for v5.10 2020-10-22 12:56:33 -07:00
reset ARM: SoC-related driver updates 2020-10-24 10:39:22 -07:00
rpmsg rpmsg updates for 5.10 2020-10-22 12:58:21 -07:00
rtc rtc: pcf2127: fix pcf2127_nvmem_read/write() returns 2020-12-30 11:52:57 +01:00
s390 Networking fixes for 5.10-rc6, including fixes from the WiFi driver, 2020-11-27 14:38:02 -08:00
sbus
scsi scsi: pm80xx: Do not sleep in atomic context 2020-12-30 11:53:27 +01:00
sfi
sh
siox
slimbus slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI 2020-12-30 11:53:24 +01:00
soc soc: rockchip: io-domain: Fix error return code in rockchip_iodomain_probe() 2020-12-30 11:53:34 +01:00
soundwire soundwire: master: use pm_runtime_set_active() on add 2020-12-30 11:53:28 +01:00
spi spi: spi-fsl-dspi: Use max_native_cs instead of num_chipselect to set SPI_MCR 2020-12-30 11:53:27 +01:00
spmi
ssb
staging staging: mfd: hi6421-spmi-pmic: fix error return code in hi6421_spmi_pmic_probe() 2020-12-30 11:53:19 +01:00
target SCSI fixes on 20201120 2020-11-20 16:24:28 -08:00
tc
tee ARM: SoC fixes for v5.10, part 3 2020-11-27 14:48:03 -08:00
thermal thermal: ti-soc-thermal: Disable the CPU PM notifier for OMAP4430 2020-11-12 12:30:29 +01:00
thunderbolt thunderbolt: Fix use-after-free in remove_unplugged_switch() 2020-11-19 17:44:10 +03:00
tty serial: 8250-mtk: Fix reference leak in mtk8250_probe 2020-12-30 11:53:23 +01:00
uio uio: Fix use-after-free in uio_unregister_device() 2020-11-09 18:54:30 +01:00
usb usb/max3421: fix return error code in max3421_probe() 2020-12-30 11:53:15 +01:00
vdpa vdpa: mlx5: fix vdpa/vhost dependencies 2020-12-02 04:09:56 -05:00
vfio vfio-pci: Use io_remap_pfn_range() for PCI IO memory 2020-12-30 11:53:31 +01:00
vhost vhost_vdpa: return -EFAULT if copy_to_user() fails 2020-12-02 04:36:40 -05:00
video video: fbdev: atmel_lcdfb: fix return error code in atmel_lcdfb_of_init() 2020-12-30 11:53:13 +01:00
virt nitro_enclaves: Fixup type and simplify logic of the poll mask setup 2020-11-09 18:20:36 +01:00
virtio vhost,vdpa,virtio: cleanups, fixes 2020-10-23 11:00:57 -07:00
visorbus
vlynq
vme
w1
watchdog ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
xen xen: don't use page->lru for ZONE_DEVICE memory 2020-12-09 10:31:41 +01:00
zorro
Kconfig
Makefile vdpa: mlx5: fix vdpa/vhost dependencies 2020-12-02 04:09:56 -05:00