[RFC PATCH 2/4] USB: EHCI: don't release ehci->lock if URB giveback in tasklet context
Alan Stern
stern at rowland.harvard.edu
Sun Jun 9 12:06:24 EDT 2013
On Sun, 9 Jun 2013, Ming Lei wrote:
> If HCD_BH is set for HC driver's flags, URB giveback will be
> done in tasklet context instead of interrupt context, so the
> ehci->lock needn't to be released any more before calling
> usb_hcd_giveback_urb().
Ah, this is the reason why you don't need to release the private lock.
I'm not sure that this will save much time overall.
With the existing code, the main reason for lock contention would be if
(for example) CPU 2 submitted or cancelled an URB while the giveback
was occurring on CPU 1. Then CPU 1 would be forced to wait while CPU 2
finished its submission or cancellation.
With this patch, it's the other way around. CPU 2 would be forced to
wait while CPU 1 does all the rest of the work in its interrupt
handler. The total time spent holding the lock will be the same; it
will just be distributed differently among the CPUs. Hence it is not
at all clear that this change will save any time.
Alan Stern
More information about the linux-arm-kernel
mailing list