On Wed, 12 Oct 2005, Franck wrote: > > Remember that the only data protected by urb->lock is urb->status, > > urb->urb_list, and urb->reject. Your HCD should change nothing but the > > status. > > > > it also changes hcpriv, actual_length, interval, start_frame...hcpriv > and actual_length seem to be only used by hcd. I don't know for the 2 > others.
I meant that the HCD shouldn't change urb->urb_list or urb->reject. > I suspect this is the problem of kref madness...let's follow this call graph > > usb_internal_control_msg > usb_start_wait_urb > usb_submit_urb > hcd_submit_urb <- urb->kref->count = 1 > link urb in ep's list > <- HCD interrupt, send URB > [ ....] > <- give back urb: > urb->kref->count = 0 > usb_get_urb > kref_get <- MADNESS urb->kref->count = 0 > hcd->urb_enqueue > > If an interrupt occurs right after inserting the urb into ep's list, > this urb can be transfered and gave back to the driver before > usb_get_urb is called ! Yep, that could do it. > A simple fix is to link urb right after > calling hcd->urb_enqueue. What do you think about this ? Not good. The URB must be linked before the HCD is called. Your idea runs the risk of the opposite problem: giving back the URB before it has been added to the endpoint's list! (Not with your HCD, but with others.) I still think think using the endpoint's URB list in your HCD isn't a good idea. That list can be updated at any time by usbcore. If your HCD happens to be following the list pointers when that happens, you could easily get into trouble. Of course, this will never arise on a UP system if your HCD runs with interrupts disabled. But it's a real possibility (even if low probability) on SMP. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel