Am Donnerstag, 15. Februar 2007 23:23 schrieb Alan Stern:
> On Thu, 15 Feb 2007, Oliver Neukum wrote:
> 
> > Am Donnerstag, 15. Februar 2007 22:06 schrieb Alan Stern:

> > > should be able to synchronize I/O submissions done in interrupt context
> > > with device suspends (i.e., avoid the problem where usbhid submits an
> > > output URB and the device is autosuspended before the URB can complete 
> > > because of a race).
> > 
> > Therefore I introduced a callback, which can use a spinlock. That particular
> > race I closed.
> 
> Hmm...  How about using your spinlock to synchronize URB submissions with
> the driver's suspend() method instead?  That way, if an important URB is
> in flight you simply fail the suspend call.  You can check the auto_pm
> flag in the usb_struct first, to avoid failing non-auto suspends.  In a 
> way, this amounts to using the already-existing suspend() method for your 
> callback rather than introducing a new one.

imho caring about the reason for a suspension is a bit messy. The current
code is nice. It just introduces a new method.
And it opens another can of worms. When may I autoresume for output?
Suppose an autosuspended device gets another suspend.


> It does in the usb-storage case.  We raise the count whenever a I/O
> transfer starts, and decrement it when the transfer finishes (setting the
> DEVICE_BUSY flag as well).  These are lightweight operations, without much
> overhead other than acquiring the pm_mutex.  If the timer expires while an
> operation is in progress, usbcore sees the elevated count and restarts the

Why restart? You could always restated if you lower the count again.

> timer.  An autosuspend won't occur until there are two timer expirations
> with no I/O activity in between.  You're also safe if the timer expires 
> more than once during a single long-lived transfer.

Yes. I understand why you don't delete the timer once the count goes up
or mod it when the count goes down, but why restart?
On the downside you now need to count timers firing and detecting idle.

        Regards
                Oliver

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to