Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-06 Thread David Brownell
On Friday 06 July 2007, Alan Stern wrote: > On Fri, 6 Jul 2007, David Brownell wrote: > > > On Monday 02 July 2007, Alan Cox wrote: > > > > > Why not just bite the bullet and change the callback convention. ... > > > > On the other hand, that *could* dovetail nicely with the proposed > > change o

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-06 Thread Alan Stern
On Fri, 6 Jul 2007, David Brownell wrote: > On Monday 02 July 2007, Alan Cox wrote: > > > Why not just bite the bullet and change the callback convention. The lock > > verification code should catch the cases that matter and which are > > overlooked on a code scan. You could also change the name

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-06 Thread David Brownell
On Monday 02 July 2007, Alan Cox wrote: > Why not just bite the bullet and change the callback convention. The lock > verification code should catch the cases that matter and which are > overlooked on a code scan. You could also change the name of the callback > to be sure it breaks anything out o

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Steven Rostedt
Alan Stern wrote: > On Tue, 3 Jul 2007, Steven Rostedt wrote: > > You never answered my second question. Is this sort of thing > acceptable? Doh! I never noticed your second question. Sorry about that. > > DECLARE_SPINLOCK(lock); > > static void irq_handler() > { > spin_lock_irqsave(&l

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Alan Stern
On Tue, 3 Jul 2007, Steven Rostedt wrote: > The problem that we are facing in this thread is that the RT patch > doesn't touch local_irq_save and restore. These still turn off > interrupts, and can be a problem with the RT patch. We need a tight > coupling between spin_lock and irq disable. Th

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Steven Rostedt
Jiri Kosina wrote: > On Tue, 3 Jul 2007, Steven Rostedt wrote: > >> Unfortunately that would not work in the RT case either. Because in RT, >> that spin_lock can schedule, and we are not allowed to schedule with >> interrupts disabled. > > So how do you handle in RT all the current code everywh

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Steven Rostedt
Jiri Kosina wrote: > On Tue, 3 Jul 2007, Felipe Balbi wrote: > >> So looks like we don't have (yet) a way to make it work nicely in both >> cases... does anyone has a clue about how to implement this one?? > > You of course still can > > local_irq_save(flags); > spin_lock(&some_lock

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Jiri Kosina
On Tue, 3 Jul 2007, Steven Rostedt wrote: > Unfortunately that would not work in the RT case either. Because in RT, > that spin_lock can schedule, and we are not allowed to schedule with > interrupts disabled. So how do you handle in RT all the current code everywhere in the tree, which does p

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Jiri Kosina
On Tue, 3 Jul 2007, Felipe Balbi wrote: > So looks like we don't have (yet) a way to make it work nicely in both > cases... does anyone has a clue about how to implement this one?? You of course still can local_irq_save(flags); spin_lock(&some_lock); ... spin_unl

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Felipe Balbi
On 7/3/07, Jiri Kosina <[EMAIL PROTECTED]> wrote: > On Mon, 2 Jul 2007, Alan Cox wrote: > > > > spin_lock_irqsave(&some_lock, flags); > > > ... > > > spin_unlock(&some_lock); > > > usb_hcd_giveback_urb(hcd, urb); > > > local_irq_restore(flags); > > > or is there a better approac

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Jiri Kosina
On Mon, 2 Jul 2007, Alan Cox wrote: > > spin_lock_irqsave(&some_lock, flags); > > ... > > spin_unlock(&some_lock); > > usb_hcd_giveback_urb(hcd, urb); > > local_irq_restore(flags); > > or is there a better approach? > Why not just bite the bullet and change the callback convent

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-02 Thread Steven Rostedt
Alan Cox wrote: >> The reason for doing this is historical; usb_hcd_giveback_urb() is >> documented as running with local IRQs disabled, and many drivers depend >> on that. For example, their callback routines invoked by >> usb_hcd_giveback_urb do spin_lock() instead of spin_lock_irqsave(). > >

Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-02 Thread Alan Cox
> The reason for doing this is historical; usb_hcd_giveback_urb() is > documented as running with local IRQs disabled, and many drivers depend > on that. For example, their callback routines invoked by > usb_hcd_giveback_urb do spin_lock() instead of spin_lock_irqsave(). > > So what's the best

[linux-usb-devel] RT-friendly IRQ management in USB

2007-07-02 Thread Alan Stern
Steven: At OSL you mentioned that local_irq_{save,disable} is unfriendly for RT and spin_lock_irq[save] is greatly preferred. As it happens, the USB core contains several instances of this code pattern: local_irq_save(flags); spin_lock(&some_lock); ... spin_unlock