On Thu, May 03, 2001 at 12:54:59AM +0200, Martin Diehl wrote:
> On Wed, 2 May 2001, Oliver Neukum wrote:
> 
> > as was recently discussed, sleep_on and derivates, which have a little race 
> > problem are used 21 times in drivers/usb
> 
> and 12 more in drivers/usb/serial ;-)

Yeah, I just realized that :(

I'll try to get to these this week.
Need to look up how to replace interruptible_sleep_on_timeout() with the
new scheme...

Help is greatly appreciated :)

> Don't want to be pedantic, but there are some more issues:
> 
> - current state should be set to TASK_INTERRUPTIBLE for each loop
>   traversing. schedule() always returns RUNNABLE, so we would only
>   sleep once.
> - memory barriers required to make sure we are really on the wait_queue
>   before testing whether to sleep - otherwise there would be a race in
>   case the interrupt/wakeup is executed on other CPU
> - better use set_current_state() - it provides the memory barrier when
>   placed between add_wait_queue() and sleep/nosleep decision
> - sleep/nosleep decision must be atomic. If this is enforced by a spinlock
>   we may use __set_current_state() (which does not serialize).

Some of these seem a bit extreme compared to the fixups that I'm seeing
going across linux-kernel right now.

thanks,

greg k-h

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to