2005/10/12, Alan Stern <[EMAIL PROTECTED]>: > 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. >
It was. I have no more badness in kref counter. By the way David, can this problem happen with sl811 hcd ? > > 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.) > OK, so we can link it just before calling HCD enqueue method ? Actually the issue is that we link an URB before it's fully initialized. > 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. Hm, this mean that we need to duplicate information there. IMHO, usbcore should be aware that it shares this list with at least HCD. And once an urb is linked, usbcore or other must use an interface to unlink URB or to modify linked URB. Thanks -- Franck ------------------------------------------------------- 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