when unregistering the configfs driver on my beaglebone black (running linux-4.12-rc6), this happens: root@beaglebone:/sys/kernel/config/usb_gadget/g_ecm|0 # echo > UDC [ 39.074784] [ 39.076361] ====================================================== [ 39.082815] WARNING: possible circular locking dependency detected [ 39.089272] 4.12.0-rc6 #3 Not tainted [ 39.093093] ------------------------------------------------------ [ 39.099547] sh/177 is trying to acquire lock: [ 39.104096] (((&glue->timer))){+.-...}, at: [<c01b7458>] del_timer_sync+0x0/0xd0 [ 39.111951] [ 39.111951] but task is already holding lock: [ 39.118040] (&(&musb->lock)->rlock){-.-...}, at: [<bf1addf4>] musb_gadget_stop+0x24/0x108 [musb_hdrc] [ 39.127805] [ 39.127805] which lock already depends on the new lock. [ 39.127805] [ 39.136346] [ 39.136346] the existing dependency chain (in reverse order) is: [ 39.144159] [ 39.144159] -> #1 (&(&musb->lock)->rlock){-.-...}: [ 39.150726] otg_timer+0x80/0x194 [musb_dsps] [ 39.155813] call_timer_fn+0xb4/0x388 [ 39.160182] expire_timers+0xe4/0x1f0 [ 39.164545] run_timer_softirq+0x94/0x19c [ 39.169274] __do_softirq+0x140/0x510 [ 39.173639] irq_exit+0xe4/0x160 [ 39.177557] __handle_domain_irq+0x6c/0xe0 [ 39.182380] __irq_svc+0x70/0x98 [ 39.186293] __und_usr+0x58/0x78 [ 39.190203] [ 39.190203] -> #0 (((&glue->timer))){+.-...}: [ 39.196306] del_timer_sync+0x40/0xd0 [ 39.200673] musb_stop+0x1c/0x60 [musb_hdrc] [ 39.205680] musb_gadget_stop+0x68/0x108 [musb_hdrc] [ 39.211414] usb_add_gadget_udc+0x70/0x90 [udc_core] [ 39.217134] usb_gadget_unregister_driver+0x64/0xd0 [udc_core] [ 39.223786] gadgets_make+0x278/0x29c [libcomposite] [ 39.229513] gadget_dev_desc_UDC_store+0x84/0xd0 [libcomposite] [ 39.236248] configfs_write_file+0xf4/0x188 [ 39.241158] __vfs_write+0x1c/0x114 [ 39.245340] vfs_write+0xa0/0x168 [ 39.249345] SyS_write+0x3c/0x90 [ 39.253264] ret_fast_syscall+0x0/0x1c [ 39.257718] [ 39.257718] other info that might help us debug this: [ 39.257718] [ 39.266063] Possible unsafe locking scenario: [ 39.266063] [ 39.272244] CPU0 CPU1 [ 39.276963] ---- ---- [ 39.281684] lock(&(&musb->lock)->rlock); [ 39.285957] lock(((&glue->timer))); [ 39.292413] lock(&(&musb->lock)->rlock); [ 39.299319] lock(((&glue->timer))); [ 39.303144] [ 39.303144] *** DEADLOCK *** [ 39.303144] [ 39.309331] 5 locks held by sh/177: [ 39.312972] #0: (sb_writers#7){.+.+.+}, at: [<c02add90>] vfs_write+0x148/0x168 [ 39.320709] #1: (&buffer->mutex){+.+.+.}, at: [<c03330d0>] configfs_write_file+0x2c/0x188 [ 39.329434] #2: (&gi->lock){+.+.+.}, at: [<bf2e68d0>] gadget_dev_desc_UDC_store+0x48/0xd0 [libcomposite] [ 39.339538] #3: (udc_lock){+.+.+.}, at: [<bf194f04>] usb_gadget_unregister_driver+0x28/0xd0 [udc_core] [ 39.349443] #4: (&(&musb->lock)->rlock){-.-...}, at: [<bf1addf4>] musb_gadget_stop+0x24/0x108 [musb_hdrc] [ 39.359643] [ 39.359643] stack backtrace: [ 39.364201] CPU: 0 PID: 177 Comm: sh Not tainted 4.12.0-rc6 #3 [ 39.370286] Hardware name: Generic AM33XX (Flattened Device Tree) [ 39.376663] [<c0110254>] (unwind_backtrace) from [<c010c2d0>] (show_stack+0x10/0x14) [ 39.384761] [<c010c2d0>] (show_stack) from [<c04b3164>] (dump_stack+0xac/0xe0) [ 39.392318] [<c04b3164>] (dump_stack) from [<c019217c>] (print_circular_bug+0x1d0/0x308) [ 39.400763] [<c019217c>] (print_circular_bug) from [<c0195508>] (__lock_acquire+0x15b0/0x18c8) [ 39.409762] [<c0195508>] (__lock_acquire) from [<c019612c>] (lock_acquire+0xcc/0x238) [ 39.417944] [<c019612c>] (lock_acquire) from [<c01b7498>] (del_timer_sync+0x40/0xd0) [ 39.426048] [<c01b7498>] (del_timer_sync) from [<bf1a54dc>] (musb_stop+0x1c/0x60 [musb_hdrc]) [ 39.434955] [<bf1a54dc>] (musb_stop [musb_hdrc]) from [<bf1ade38>] (musb_gadget_stop+0x68/0x108 [musb_hdrc]) [ 39.445226] [<bf1ade38>] (musb_gadget_stop [musb_hdrc]) from [<bf194ebc>] (usb_add_gadget_udc+0x70/0x90 [udc_core]) [ 39.456131] [<bf194ebc>] (usb_add_gadget_udc [udc_core]) from [<bf194f40>] (usb_gadget_unregister_driver+0x64/0xd0 [udc_core]) [ 39.468026] [<bf194f40>] (usb_gadget_unregister_driver [udc_core]) from [<bf2e66e4>] (gadgets_make+0x278/0x29c [libcomposite]) [ 39.479930] [<bf2e66e4>] (gadgets_make [libcomposite]) from [<bf2e690c>] (gadget_dev_desc_UDC_store+0x84/0xd0 [libcomposite]) [ 39.491755] [<bf2e690c>] (gadget_dev_desc_UDC_store [libcomposite]) from [<c0333198>] (configfs_write_file+0xf4/0x188) [ 39.502920] [<c0333198>] (configfs_write_file) from [<c02ac4bc>] (__vfs_write+0x1c/0x114) [ 39.511455] [<c02ac4bc>] (__vfs_write) from [<c02adce8>] (vfs_write+0xa0/0x168) [ 39.519080] [<c02adce8>] (vfs_write) from [<c02aeaec>] (SyS_write+0x3c/0x90) [ 39.526430] [<c02aeaec>] (SyS_write) from [<c0107760>] (ret_fast_syscall+0x0/0x1c) root@beaglebone:/sys/kernel/config/usb_gadget/g_ecm|0 # -- 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