On Tue, Dec 13, 2016 at 3:51 PM, John Youn <John.Youn@xxxxxxxxxxxx> wrote: > On 12/13/2016 3:23 PM, John Stultz wrote: >> I've found trying to boot Linus' HEAD today on HiKey, I'm hitting the >> following WARNINGS/panics, which I bisected down to being introduced >> with 5f54c54b0ba8 ("Add DDMA chain pointers to dwc2_hsotg_ep >> structure"). >> >> It seems the issue is calling dma_alloc_coherent() in >> dwc2_hsotg_ep_enable() isn't safe, as we may get there from irq >> context with irqs off. >> >> Any thoughts on a fix? >> > > Hi John, > > Check this: > http://marc.info/?l=linux-usb&m=148058361526211&w=2 So digging further here, it seems that patch addresses the allocation side, but I'm also seeing warnings on the free side, as irqs are disabled in dwc2_hsotg_vbus_session() before calling dwc2_hsotg_disconnect(). [ 94.187771] ------------[ cut here ]------------ [ 94.192454] WARNING: CPU: 0 PID: 3 at ./include/linux/dma-mapping.h:479 dwc2_hsotg_ep_disable+0x180/0x1b0 [ 94.202047] [ 94.203577] CPU: 0 PID: 3 Comm: kworker/0:0 Tainted: G W 4.9.0-06789-g055090c-dirty #1754 [ 94.212911] Hardware name: HiKey Development Board (DT) [ 94.218179] Workqueue: events dwc2_hcd_extcon_func [ 94.223017] task: ffffffc0387e1900 task.stack: ffffffc005f44000 [ 94.228972] PC is at dwc2_hsotg_ep_disable+0x180/0x1b0 [ 94.234148] LR is at usb_ep_disable+0x48/0x60 [ 94.238535] pc : [<ffffff8008688b08>] lr : [<ffffff80086ae970>] pstate: 800001c5 [ 94.245956] sp : ffffffc005f47bc0 [ 94.249294] x29: ffffffc005f47bc0 x28: ffffffc077f2f2a8 [ 94.254669] x27: ffffffc077f2f078 x26: 0000000078000000 [ 94.260045] x25: ffffff8008013000 x24: ffffffc074559018 [ 94.265420] x23: ffffff8008d29dc0 x22: 0000000000000000 [ 94.270793] x21: ffffffc075135c10 x20: 0000000000000001 [ 94.276167] x19: ffffffc074c97918 x18: 0000000000000010 [ 94.281540] x17: 00000000ce000000 x16: 0000000000000040 [ 94.286912] x15: ffffff8088dae367 x14: 0000000000000006 [ 94.292284] x13: ffffff8008dae375 x12: 0000000000000007 [ 94.297656] x11: 00000000000003a8 x10: 0000000005f5e0ff [ 94.303028] x9 : 00000000000003a9 x8 : ffffff80083b72f8 [ 94.308400] x7 : ffffff8008d47190 x6 : 0000000000000024 [ 94.313773] x5 : ffffff8008fa0000 x4 : 000000000001fff4 [ 94.319144] x3 : 0000000000000003 x2 : 0000000000000003 [ 94.324516] x1 : ffffff8008688988 x0 : 00000000000001c0 [ 94.329884] [ 94.331399] ---[ end trace 07f033317005386d ]--- [ 94.336040] Call trace: [ 94.338519] Exception stack(0xffffffc005f479f0 to 0xffffffc005f47b20) [ 94.344995] 79e0: ffffffc074c97918 0000008000000000 [ 94.352866] 7a00: ffffffc005f47bc0 ffffff8008688b08 00000000000003a9 ffffff80080fec78 [ 94.360733] 7a20: ffffffc005f47a90 ffffff80080ff1ac ffffff8008db0790 0000000000000004 [ 94.368602] 7a40: ffffff8008dad000 ffffff8008d35a70 0000000000000014 0000000000000000 [ 94.376470] 7a60: 0000000000000014 0000000000000000 0000000000000002 00000000000001c0 [ 94.384341] 7a80: ffffff8008db0790 ffffff8008bc1590 00000000000001c0 ffffff8008688988 [ 94.392210] 7aa0: 0000000000000003 0000000000000003 000000000001fff4 ffffff8008fa0000 [ 94.400080] 7ac0: 0000000000000024 ffffff8008d47190 ffffff80083b72f8 00000000000003a9 [ 94.407948] 7ae0: 0000000005f5e0ff 00000000000003a8 0000000000000007 ffffff8008dae375 [ 94.415816] 7b00: 0000000000000006 ffffff8088dae367 0000000000000040 00000000ce000000 [ 94.423683] [<ffffff8008688b08>] dwc2_hsotg_ep_disable+0x180/0x1b0 [ 94.429902] [<ffffff80086ae970>] usb_ep_disable+0x48/0x60 [ 94.435315] [<ffffff80086b7120>] ffs_func_eps_disable.isra.8+0x58/0x98 [ 94.441842] [<ffffff80086b7214>] ffs_func_set_alt+0xb4/0x2a0 [ 94.447501] [<ffffff80086b7414>] ffs_func_disable+0x14/0x20 [ 94.453075] [<ffffff80086a8b9c>] composite_disconnect+0x4c/0xa0 [ 94.458993] [<ffffff800868864c>] dwc2_hsotg_disconnect.part.20+0xac/0xe8 [ 94.465693] [<ffffff800868a79c>] dwc2_hsotg_vbus_session+0xac/0xd0 [ 94.471874] [<ffffff80086aec5c>] usb_gadget_vbus_disconnect+0x1c/0x30 [ 94.478314] [<ffffff8008688d78>] dwc2_gadget_notify+0x18/0x30 [ 94.484060] [<ffffff800867b540>] dwc2_hcd_extcon_func+0x60/0x78 [ 94.489980] [<ffffff80080ccbe8>] process_one_work+0x118/0x370 [ 94.495725] [<ffffff80080cce88>] worker_thread+0x48/0x498 [ 94.501123] [<ffffff80080d2fe0>] kthread+0x100/0x130 [ 94.506088] [<ffffff8008082e80>] ret_from_fork+0x10/0x50 (Note that this is triggered using the extcon patch I have, but the problematic logic seems to be pre-existing). thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html