> Date: Mon, 3 Dec 2001 13:33:53 +0100 (CET)
> From: Martin Diehl <[EMAIL PROTECTED]>

> > > - the ioctl blocks (no, not sleep_on) on the completion (i.e. until
> > > urb->status becomes != EINPROGRESS).
> > 
> > BTW, This is broken. The ioctl must block until a callback
> > is triggered. It is safe to examing urb->status only after
> > the callback awakens the requesting thread or inside the callback.

> Sure, urb->status is modified from interrupt context. But the read for
> comparison should be atomic (although not explicitly).
>[...] 
> The only thing I'm wondering is whether urb->status would need to be
> qualified volatile to prevent the compiler from bad assumptions.

You mentally focused in wrong place, it's not about atomicity at all.
Suppose that you have a compiled with low optimizations and SMP.
The thread that checks for the status may get a signal and
be awaken before callback is called, but after status was set.
In that case something oopses: either the thread, or the HCA
interrupt.

It is very easy to trigger with ISOs by hittinc ^C until the
box oopses, not so easy with normal transfers. But still,
better be safe.

-- Pete

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

Reply via email to