From: "Dimitris Michailidis" <dimitris@cthulhu.engr.sgi.com>
> Speaking of this sleep_on+unlock race that is still present in a few
drivers,
usb?
> how about adding sleep_on_unlock(wait_q, lock) that would unlock the
supplied
> lock at the right time, after adding the process to the wait queue? This
> race used to be present in the scsi code and has been fixed with the
folowing
> (comments removed):
Ingo added wait_event() for drivers that don't need a spinlock.
I'm not sure that another "wait_event_spinlock()" is really required: we are
talking about 5 lines of code, and dozends of possible variations. [with
signals, without signals, acquire the spinlock if a signal arrives, return
without the spinlock on signal delivery, spin_lock or spin_lock_irq, with
timeout or without timeout]
add_wait_queue(&device->scpnt_wait, &wait);
if( interruptable ) {
set_current_state(TASK_INTERRUPTIBLE);
} else {
set_current_state(TASK_UNINTERRUPTIBLE);
}
spin_unlock_irqrestore(&device_request_lock, flags);
schedule();
It would be possible to optimize this one: __set_current_state() instead of
set_current_state(): the memory barrier is superfluous due to the spinlock.
-- Manfred- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:37 EST