hi Ming: >>> One approach I like to use is trace event. >> Would you please let us how to to use trace event for calculate >> max/average usb irq time? > > You can enable irq_handler_entry and irq_handler_exit event, then > write a script easily to figure out the time consumed in ehci irq handler, > see Documentation/trace/events.txt of linux kernel for detailed steps. I find it ^^ >>> But actually the local interrupt is still disabled during completion >>> because we need to convert spin_lock in all current usb drivers >>> to spin_lock_irqsave() first. >> Would you please let me know the function or source you mentioned? > > The local interrupt is disabled during completion handler in > __usb_hcd_giveback_urb(). > >> >> BTW, why I cannot see xhci add HCD_BH? > > There might be some reasons: > > - in previous following up discussion, Alan thought it should > be easier to just split the hcd interrupt handler into two parts > > - as I said, spin_lock() isn't converted to spin_lock_irqsave() > in drivers' completion handler yet Do you mean , take uvc/uac for example, if we put completion what they register previously in BH, the spin_lock() in their completions should be changed to spin_lock_irqsave()? Is it due to original completion is called in irq context? > > - maybe no one really care the time in which local interrupt is > disabled by USB completion handler.(That might be true > because USB devices are commonly used in personal > computer, not in big server product) > >> is there some reason xhci cannot put completion in BH? > > IMO, the completion handler should be put into tasklet, and > can be done. If you like, you can take time to do that. Below is so far kernel implementation. Isn't it put completion handler into tasklet? ....................... ...................... spin_lock(&bh->lock); list_add_tail(&urb->urb_list, &bh->head); running = bh->running; spin_unlock(&bh->lock); if (running) ; else if (high_prio_bh) tasklet_hi_schedule(&bh->bh); else tasklet_schedule(&bh->bh); Thanks for your help, -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html