Re: [PATCH v2 2/2] Driver for the Atmel USBA on-chip UDC
David Brownell <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <20070926175303.55420219ECD@adsl-69-226-248-13.dsl.pltn13.pacbell.net> |
I tripped over a locking bug when I tried this: BUG: spinlock recursion on CPU#0, swapper/0 lock: 901d2b18, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 Call trace: [<900134b0>] dump_stack+0x18/0x20 [<900bb792>] spin_bug+0x6a/0x7c [<900bb93a>] _raw_spin_lock+0x26/0xd0 [<90141a8a>] _spin_lock_irqsave+0xe/0x14 [<900dee2a>] usba_ep_queue+0x10e/0x198 [<c08780c0>] zero_setup+0x3b4/0x40c [g_zero] [<900df618>] usba_udc_irq+0x72e/0x8c6 [<9002ffcc>] handle_IRQ_event+0x1e/0x42 [<90030fc2>] handle_simple_irq+0x66/0x94 [<90011356>] do_IRQ+0x2e/0x54 [<900104fe>] irq_level0+0x18/0x5e [<901401be>] rest_init+0x3a/0x48 [<90000570>] start_kernel+0x1e4/0x214 [<00000000>] 0x0 BUG: spinlock lockup on CPU#0, swapper/0, 901d2b18 Call trace: [<900134b0>] dump_stack+0x18/0x20 [<900bb9b8>] _raw_spin_lock+0xa4/0xd0 [<90141a8a>] _spin_lock_irqsave+0xe/0x14 [<900dee2a>] usba_ep_queue+0x10e/0x198 [<c08780c0>] zero_setup+0x3b4/0x40c [g_zero] [<900df618>] usba_udc_irq+0x72e/0x8c6 [<9002ffcc>] handle_IRQ_event+0x1e/0x42 [<90030fc2>] handle_simple_irq+0x66/0x94 [<90011356>] do_IRQ+0x2e/0x54 [<900104fe>] irq_level0+0x18/0x5e [<901401be>] rest_init+0x3a/0x48 [<90000570>] start_kernel+0x1e4/0x214 [<00000000>] 0x0 This happened when I plugged in a gadget zero peripheral, but given the nature of this bug I'd expect it to show up with every gadget driver. Every time you call out from the UDC driver to a gadget driver, you need to drop the lock ... so that it can call back in to the driver, without causing lock recursion bugs like the one above. (Also, it's good practice to run with memory poisoning and lock debugging enabled all the time if you're a developer ... you never know when you'll accidentally insert a bug, and it's easier to track them down if you can at least say that "it must have been one of the changes I made this morning", while those changes are fresh on your mind!) - Dave ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel