On Thu, 21 Mar 2013, Michael Trimarchi wrote: > Dear Alan > > I'm facing an issue on isoc sitd dma recycling. I'm using an omap3 (beableboard xM) board > and after a while I don't have anymore the possibity to allocate dma sitd from the pool > (128Kb, 1M, 4M, it is a matter of time). > I'm playing flac music from usb disk and send on a dac connected to another usb port of the same > controller. You should take a look at the email thread starting here: http://marc.info/?l=linux-usb&m=136294120300771&w=2 It discusses the same problem. > Right now I'm experimenting this patch (not for any submission) and it seems that it masks/fixes > the problem. > > > diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c > index b476daf..183d4ec 100644 > --- a/drivers/usb/host/ehci-sched.c > +++ b/drivers/usb/host/ehci-sched.c > @@ -1166,7 +1166,8 @@ itd_urb_transaction ( > gfp_t mem_flags > ) > { > - struct ehci_itd *itd; > + struct ehci_itd *itd = NULL; > + bool found; > dma_addr_t itd_dma; > int i; > unsigned num_itds; > @@ -1187,18 +1188,24 @@ itd_urb_transaction ( > /* allocate/init ITDs */ > spin_lock_irqsave (&ehci->lock, flags); > for (i = 0; i < num_itds; i++) { > + found = false; > > /* > * Use iTDs from the free list, but not iTDs that may > * still be in use by the hardware. > */ > if (likely(!list_empty(&stream->free_list))) { > - itd = list_first_entry(&stream->free_list, > - struct ehci_itd, itd_list); > - if (itd->frame == ehci->now_frame) > + list_for_each_entry(itd, &stream->free_list, > + itd_list) { > + if (itd->frame != ehci->now_frame) { > + list_del(&itd->itd_list); > + itd_dma = itd->itd_dma; > + found = true; > + break; > + } > + } > + if (found == false) > goto alloc_itd; > - list_del (&itd->itd_list); > - itd_dma = itd->itd_dma; > } else { ... > What do you think? Since entries are added to the free list at the end and removed at the beginning, this shouldn't make any difference. The frame numbers of the itds (or sitds) on the list should be in increasing order, and only the last few entries should have frame numbers equal to ehci->now_frame. Have you tried printing out the values of the sitds in the list, along with ehci->now_frame, to see what they are? Alan Stern -- 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