linux/drivers/usb
Marek Szyprowski 41a91c606e usb: dwc3: move synchronize_irq() out of the spinlock protected block
dwc3_gadget_suspend() is called under dwc->lock spinlock. In such context
calling synchronize_irq() is not allowed. Move the problematic call out
of the protected block to fix the following kernel BUG during system
suspend:

BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
6 locks held by rtcwake/1601:
 #0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
 #1: b5fe1270 (&of->mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4
 #2: 7e597705 (kn->count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4
 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04
 #4: fc7f1c42 (&dev->mutex){....}, at: __device_suspend+0xd8/0x74c
 #5: 4b36507e (&(&dwc->lock)->rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
irq event stamp: 11252
hardirqs last  enabled at (11251): [<c09c54a4>] _raw_spin_unlock_irqrestore+0x6c/0x74
hardirqs last disabled at (11252): [<c09c4d44>] _raw_spin_lock_irqsave+0x1c/0x5c
softirqs last  enabled at (9744): [<c0102564>] __do_softirq+0x3a4/0x66c
softirqs last disabled at (9737): [<c0128528>] irq_exit+0x140/0x168
Preemption disabled at:
[<00000000>]   (null)
CPU: 7 PID: 1601 Comm: rtcwake Not tainted
5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c01110f0>] (unwind_backtrace) from [<c010d120>] (show_stack+0x10/0x14)
[<c010d120>] (show_stack) from [<c09a4d04>] (dump_stack+0x90/0xc8)
[<c09a4d04>] (dump_stack) from [<c014c700>] (___might_sleep+0x22c/0x2c8)
[<c014c700>] (___might_sleep) from [<c0189d68>] (synchronize_irq+0x28/0x84)
[<c0189d68>] (synchronize_irq) from [<c05cbbf8>] (dwc3_gadget_suspend+0x34/0x3c)
[<c05cbbf8>] (dwc3_gadget_suspend) from [<c05bd020>] (dwc3_suspend_common+0x154/0x410)
[<c05bd020>] (dwc3_suspend_common) from [<c05bd34c>] (dwc3_suspend+0x14/0x2c)
[<c05bd34c>] (dwc3_suspend) from [<c051c730>] (platform_pm_suspend+0x2c/0x54)
[<c051c730>] (platform_pm_suspend) from [<c05285d4>] (dpm_run_callback+0xa4/0x3dc)
[<c05285d4>] (dpm_run_callback) from [<c0528a40>] (__device_suspend+0x134/0x74c)
[<c0528a40>] (__device_suspend) from [<c052c508>] (dpm_suspend+0x174/0x588)
[<c052c508>] (dpm_suspend) from [<c0182134>] (suspend_devices_and_enter+0xc0/0xe74)
[<c0182134>] (suspend_devices_and_enter) from [<c0183658>] (pm_suspend+0x770/0xc04)
[<c0183658>] (pm_suspend) from [<c0180ddc>] (state_store+0x6c/0xcc)
[<c0180ddc>] (state_store) from [<c09a9a70>] (kobj_attr_store+0x14/0x20)
[<c09a9a70>] (kobj_attr_store) from [<c02d6800>] (sysfs_kf_write+0x4c/0x50)
[<c02d6800>] (sysfs_kf_write) from [<c02d594c>] (kernfs_fop_write+0xfc/0x1e4)
[<c02d594c>] (kernfs_fop_write) from [<c02593d8>] (__vfs_write+0x2c/0x160)
[<c02593d8>] (__vfs_write) from [<c0259694>] (vfs_write+0xa4/0x16c)
[<c0259694>] (vfs_write) from [<c0259870>] (ksys_write+0x40/0x8c)
[<c0259870>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
Exception stack(0xed55ffa8 to 0xed55fff0)
...

Fixes: 01c10880d2 ("usb: dwc3: gadget: synchronize_irq dwc irq in suspend")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-05-03 09:13:48 +03:00
..
atm USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
c67x00
chipidea usb: chipidea: Refactor USB PHY selection and keep a single PHY 2019-02-27 15:51:02 +01:00
class usb: cdc-acm: fix race during wakeup blocking TX traffic 2019-03-28 00:08:49 +09:00
common usb: common: Consider only available nodes for dr_mode 2019-03-19 14:57:32 +01:00
core USB: Export usb_wakeup_enabled_descendants() 2019-05-03 09:13:47 +03:00
dwc2 usb: dwc2: Delayed status support 2019-05-03 09:13:48 +03:00
dwc3 usb: dwc3: move synchronize_irq() out of the spinlock protected block 2019-05-03 09:13:48 +03:00
early memblock: drop memblock_alloc_*_nopanic() variants 2019-03-12 10:04:02 -07:00
gadget usb: gadget: udc: lpc32xx: rework interrupt handling 2019-05-03 09:13:48 +03:00
host usb: u132-hcd: fix resource leak 2019-03-28 00:08:49 +09:00
image USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
isp1760 USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
misc usb: usb251xb: fix to avoid potential NULL pointer dereference 2019-03-26 16:48:55 +09:00
mon USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
mtu3 usb: mtu3: fix EXTCON dependency 2019-03-26 16:48:56 +09:00
musb USB: musb: mark expected switch fall-through 2019-02-13 19:40:20 +01:00
phy usb: gadget: fsl: fix link error against usb-gadget module 2019-05-03 09:13:47 +03:00
renesas_usbhs USB: renesas_usbhs: fix spelling mistake "doens't" -> "doesn't" 2019-02-19 14:41:38 +01:00
roles usb: roles: Find the muxes by also matching against the device node 2019-02-14 10:52:25 +01:00
serial USB: serial: option: add Olicard 600 2019-03-28 09:27:22 +01:00
storage SCSI misc on 20190306 2019-03-09 16:53:47 -08:00
typec usb: typec: tcpm: Try PD-2.0 if sink does not respond to 3.0 source-caps 2019-03-19 14:57:31 +01:00
usbip usbip: Fix vep_free_request() null pointer checks on input args 2019-01-30 09:22:35 +01:00
wusbcore wusb: Remove unnecessary static function ckhdid_printf 2019-03-01 20:53:41 +01:00
Kconfig USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
Makefile
usb-skeleton.c usb: usb-skeleton: use irqsave() in USB's complete callback 2018-06-28 19:36:06 +09:00