linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* USB deadlock in v2.5.67
@ 2003-04-18  2:02 David Mosberger
  2003-04-18  4:50 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: David Mosberger @ 2003-04-18  2:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-ia64

So my 2.5.67 kernel was humming along nicely when I got the idea to
unplug a USB keyboard.  Instant deadlock.  The backtrace shows this:

Call Trace:
 [<e0000000048c4260>] hcd_free_dev+0x140/0x240
 [<e0000000048b96e0>] usb_release_dev+0x100/0x140
 [<e000000004743420>] device_release+0x80/0xa0
 [<e000000004697600>] kobject_cleanup+0x100/0x120
 [<e0000000048c34d0>] urb_unlink+0x110/0x1a0
 [<e0000000048c4390>] usb_hcd_giveback_urb+0x30/0x1a0
 [<e0000000048da730>] dl_done_list+0x230/0x2a0
 [<e0000000048dbfd0>] ohci_irq+0x290/0x340
 [<e0000000048c4580>] usb_hcd_irq+0x80/0x100
 [<e000000004414e00>] handle_IRQ_event+0xa0/0x120
 [<e0000000044155e0>] do_IRQ+0x360/0x460
 [<e0000000044174b0>] ia64_handle_irq+0x70/0x140
 [<e000000004411e40>] ia64_leave_kernel+0x0/0x240

<hcd_free_dev+0x140> translates into line 1249 in hcd.c, where it
does:

	spin_lock_irqsave (&hcd_data_lock, flags);

The deadlock is pretty obvious: the same lock has already been
acquired urb_unlink(), 4 levels up in the call-chain.

Anybody have a fix for this?

	--david

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USB deadlock in v2.5.67
  2003-04-18  2:02 USB deadlock in v2.5.67 David Mosberger
@ 2003-04-18  4:50 ` Greg KH
  2003-04-18 15:46   ` David Brownell
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-04-18  4:50 UTC (permalink / raw)
  To: davidm, David Brownell; +Cc: linux-kernel, linux-ia64, linux-usb-devel

On Thu, Apr 17, 2003 at 07:02:07PM -0700, David Mosberger wrote:
> So my 2.5.67 kernel was humming along nicely when I got the idea to
> unplug a USB keyboard.  Instant deadlock.  The backtrace shows this:

Ah, I just got this too, but you have the better debug trace.

> 
> Call Trace:
>  [<e0000000048c4260>] hcd_free_dev+0x140/0x240
>  [<e0000000048b96e0>] usb_release_dev+0x100/0x140
>  [<e000000004743420>] device_release+0x80/0xa0
>  [<e000000004697600>] kobject_cleanup+0x100/0x120
>  [<e0000000048c34d0>] urb_unlink+0x110/0x1a0
>  [<e0000000048c4390>] usb_hcd_giveback_urb+0x30/0x1a0
>  [<e0000000048da730>] dl_done_list+0x230/0x2a0
>  [<e0000000048dbfd0>] ohci_irq+0x290/0x340
>  [<e0000000048c4580>] usb_hcd_irq+0x80/0x100
>  [<e000000004414e00>] handle_IRQ_event+0xa0/0x120
>  [<e0000000044155e0>] do_IRQ+0x360/0x460
>  [<e0000000044174b0>] ia64_handle_irq+0x70/0x140
>  [<e000000004411e40>] ia64_leave_kernel+0x0/0x240
> 
> <hcd_free_dev+0x140> translates into line 1249 in hcd.c, where it
> does:
> 
> 	spin_lock_irqsave (&hcd_data_lock, flags);
> 
> The deadlock is pretty obvious: the same lock has already been
> acquired urb_unlink(), 4 levels up in the call-chain.
> 
> Anybody have a fix for this?

David (Brownell, that is), does this help with the trace I sent you a
few hours ago?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USB deadlock in v2.5.67
  2003-04-18  4:50 ` Greg KH
@ 2003-04-18 15:46   ` David Brownell
  2003-04-18 18:16     ` David Mosberger
  2003-04-18 23:19     ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: David Brownell @ 2003-04-18 15:46 UTC (permalink / raw)
  To: Greg KH; +Cc: davidm, linux-kernel, linux-ia64, linux-usb-devel

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

Greg KH wrote:
> On Thu, Apr 17, 2003 at 07:02:07PM -0700, David Mosberger wrote:
> 
>><hcd_free_dev+0x140> translates into line 1249 in hcd.c, where it
>>does:
>>
>>	spin_lock_irqsave (&hcd_data_lock, flags);
>>
>>The deadlock is pretty obvious: the same lock has already been
>>acquired urb_unlink(), 4 levels up in the call-chain.
>>
>>Anybody have a fix for this?
> 
> 
> David (Brownell, that is), does this help with the trace I sent you a
> few hours ago?

Seems to be a different problem.  The patch below should
resolve the keyboard problem -- just reorders two lines
so the lock isn't held after the device's records get
deleted, so the order is what it should always have been.

- Dave





[-- Attachment #2: hang.patch --]
[-- Type: text/plain, Size: 332 bytes --]

--- 1.59/drivers/usb/core/hcd.c	Mon Apr 14 14:01:44 2003
+++ edited/drivers/usb/core/hcd.c	Fri Apr 18 08:20:42 2003
@@ -961,8 +961,8 @@
 	spin_lock_irqsave (&hcd_data_lock, flags);
 	list_del_init (&urb->urb_list);
 	dev = urb->dev;
-	usb_put_dev (dev);
 	spin_unlock_irqrestore (&hcd_data_lock, flags);
+	usb_put_dev (dev);
 }
 
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USB deadlock in v2.5.67
  2003-04-18 15:46   ` David Brownell
@ 2003-04-18 18:16     ` David Mosberger
  2003-04-18 23:19     ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: David Mosberger @ 2003-04-18 18:16 UTC (permalink / raw)
  To: David Brownell; +Cc: Greg KH, davidm, linux-kernel, linux-ia64, linux-usb-devel

>>>>> On Fri, 18 Apr 2003 08:46:56 -0700, David Brownell <david-b@pacbell.net> said:

  David> Seems to be a different problem.  The patch below should
  David> resolve the keyboard problem -- just reorders two lines so
  David> the lock isn't held after the device's records get deleted,
  David> so the order is what it should always have been.

With the patch applied, I can now add/remove USB keyboards without
crashing the kernel.

Thanks!

	--david


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USB deadlock in v2.5.67
  2003-04-18 15:46   ` David Brownell
  2003-04-18 18:16     ` David Mosberger
@ 2003-04-18 23:19     ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2003-04-18 23:19 UTC (permalink / raw)
  To: David Brownell; +Cc: davidm, linux-kernel, linux-ia64, linux-usb-devel

On Fri, Apr 18, 2003 at 08:46:56AM -0700, David Brownell wrote:
> Greg KH wrote:
> >On Thu, Apr 17, 2003 at 07:02:07PM -0700, David Mosberger wrote:
> >
> >><hcd_free_dev+0x140> translates into line 1249 in hcd.c, where it
> >>does:
> >>
> >>	spin_lock_irqsave (&hcd_data_lock, flags);
> >>
> >>The deadlock is pretty obvious: the same lock has already been
> >>acquired urb_unlink(), 4 levels up in the call-chain.
> >>
> >>Anybody have a fix for this?
> >
> >
> >David (Brownell, that is), does this help with the trace I sent you a
> >few hours ago?
> 
> Seems to be a different problem.  The patch below should
> resolve the keyboard problem -- just reorders two lines
> so the lock isn't held after the device's records get
> deleted, so the order is what it should always have been.

Applied to my trees, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-18 23:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-18  2:02 USB deadlock in v2.5.67 David Mosberger
2003-04-18  4:50 ` Greg KH
2003-04-18 15:46   ` David Brownell
2003-04-18 18:16     ` David Mosberger
2003-04-18 23:19     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).