openwrt/target/linux/lantiq/patches-5.15
Hauke Mehrtens 66f6c20e45 lantiq: Fix an sleeping function called from invalid context
The ifx_pcie_bus_enum_hack() function is called in
ifx_pcie_read_config() while holding the ifx_pcie_lock spinlock. The
ifx_pcie_bus_enum_hack() function calls pci_get_slot() which could
sleep. Add a new function for pci_get_slot() which does not use a
semaphore, the mutex should be sufficient. This fixes the sleep in
atomic context which could cause a hang of the system.

This fixes the following warning seen with
CONFIG_KERNEL_DEBUG_ATOMIC_SLEEP=y.

[   12.264300] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[   12.272226] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1487
[   12.280684] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 9, name: kworker/u4:0
[   12.288781] CPU: 0 PID: 9 Comm: kworker/u4:0 Not tainted 5.15.134 #0
[   12.295135] Workqueue: events_unbound deferred_probe_work_func
[   12.300964] Stack : 80e70000 8008ac80 00000000 00000004 807c776c 8145b9ec 81424c00 800520ec
[   12.309316]         808a0000 8145ba2b 8145b844 8145b838 80414178 00000001 8145b9f8 81439ea0
[   12.317674]         00000000 00000000 807c776c 8145b838 ffffefff 00000000 00000000 ffffffea
[   12.326030]         00000081 8145b844 00000081 808a6f50 807c776c 00000000 00000000 80910000
[   12.334391]         00111bef 00000000 00000001 00000000 00000018 00000030 00000000 80e40000
[   12.342741]         ...
[   12.345177] Call Trace:
[   12.347613] [<8000c1d0>] show_stack+0x28/0xf0
[   12.351974] [<8038ba1c>] dump_stack_lvl+0x60/0x80
[   12.356667] [<8005eefc>] ___might_sleep+0x124/0x138
[   12.361547] [<806daf30>] down_read+0x24/0x88
[   12.365807] [<803cdd20>] pci_get_slot+0x2c/0xc0
[   12.370333] [<806d56ac>] ifx_pcie_read_config+0x164/0x330
[   12.375735] [<803be610>] pci_bus_read_config_dword+0x6c/0xd0
[   12.381399] [<803c20cc>] pci_bus_generic_read_dev_vendor_id+0x3c/0x1a8
[   12.387915] [<803c27ec>] pci_scan_single_device+0x88/0x154
[   12.393404] [<803c2928>] pci_scan_slot+0x70/0x134
[   12.398099] [<803c3bf0>] pci_scan_child_bus_extend+0x5c/0x320
[   12.403849] [<803c4178>] pci_scan_root_bus_bridge+0xd0/0xec
[   12.409414] [<806d45a8>] pcibios_scanbus+0xe4/0x21c
[   12.414293] [<806d4908>] register_pci_controller+0xb8/0x11c
[   12.419858] [<806d5f9c>] ifx_pcie_bios_probe+0x724/0x940
[   12.425174] [<80417574>] platform_probe+0x38/0x90
[   12.429868] [<80414d68>] really_probe.part.0+0xac/0x354
[   12.435103] [<80415298>] driver_probe_device+0x4c/0x154
[   12.440313] [<80415904>] __device_attach_driver+0xd0/0x15c
[   12.445802] [<804129d8>] bus_for_each_drv+0x70/0xb0
[   12.450676] [<80415610>] __device_attach+0xdc/0x194
[   12.455545] [<80413ca8>] bus_probe_device+0x9c/0xb8
[   12.460419] [<8041420c>] deferred_probe_work_func+0x94/0xd4
[   12.465995] [<8004fcb4>] process_one_work+0x27c/0x4c8
[   12.471044] [<80050710>] worker_thread+0x34c/0x5f8
[   12.475825] [<800587a8>] kthread+0x168/0x18c
[   12.480090] [<80006ef8>] ret_from_kernel_thread+0x14/0x1c

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-10-10 00:22:25 +02:00
..
0001-MIPS-lantiq-add-pcie-driver.patch lantiq: Fix an sleeping function called from invalid context 2023-10-10 00:22:25 +02:00
0004-MIPS-lantiq-add-atm-hack.patch
0008-MIPS-lantiq-backport-old-timer-code.patch
0018-MTD-nand-lots-of-xrx200-fixes.patch
0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch
0023-NET-PHY-add-led-support-for-intel-xway.patch
0028-NET-lantiq-various-etop-fixes.patch kernel: bump 5.15 to 5.15.77 2022-11-05 16:26:38 +01:00
0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch lantiq: replace random_ether_addr with eth_random_addr 2023-06-10 12:40:29 +02:00
0042-arch-mips-increase-io_space_limit.patch
0050-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch
0051-MIPS-lantiq-improve-USB-initialization.patch
0101-find_active_root.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0151-lantiq-ifxmips_pcie-use-of.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0152-lantiq-VPE.patch kernel: bump 5.15 to 5.15.125 2023-08-09 22:06:24 +02:00
0154-lantiq-pci-bar11mask-fix.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0155-lantiq-VPE-nosmp.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0160-owrt-lantiq-multiple-flash.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0301-xrx200-add-gphy-clk-src-device-tree-binding.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0302-mtd-cfi_cmdset_0001-Disable-write-buffer-functions-i.patch lantiq: fix compilation warning in cfi_mtdset_0001 2023-05-12 03:15:35 +02:00
0310-v5.16-MIPS-lantiq-dma-make-the-burst-length-configurable-b.patch
0320-v6.1-MIPS-lantiq-enable-all-hardware-interrupts-on-second.patch lantiq: add 6.1 tag to upstream patch 2022-10-23 01:45:52 +02:00
0400-mtd-rawnand-xway-don-t-yield-while-holding-spinlock.patch lantiq: nand: don't yield while holding spinlock 2023-04-02 17:08:45 +02:00
0701-NET-lantiq-etop-of-mido.patch lantiq: add patches headers 2023-05-31 21:58:05 +02:00
0702-v5.16-net-lantiq-add-support-for-jumbo-frames.patch
0703-v5.16-net-lantiq_xrx200-increase-buffer-reservation.patch
0704-v5.17-net-lantiq_xrx200-add-ingress-SG-DMA-support.patch
0706-v5.18-net-lantiq-enable-jumbo-frames-on-GSWIP.patch
0710-v5.16-net-lantiq-configure-the-burst-length-in-ethernet-dr.patch
0711-v5.16-net-lantiq_xrx200-Hardcode-the-burst-length-value.patch
0712-v5.16-net-ethernet-lantiq_etop-Fix-compilation-error.patch
0713-v5.17-MIPS-lantiq-dma-increase-descritor-count.patch
0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch
0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch
0716-v5.17-net-lantiq_xrx200-fix-use-after-free-bug.patch
0717-v6.0-net-lantiq_xrx200-confirm-skb-is-allocated-before-us.patch
0718-v6.0-net-lantiq_xrx200-fix-lock-under-memory-pressure.patch
0719-v6.0-net-lantiq_xrx200-restore-buffer-if-memory-allocatio.patch