On Mon, 30 Nov 2015, Oliver Neukum wrote: > On Mon, 2015-11-30 at 12:14 -0500, Alan Stern wrote: > > > +static struct usb_memory * > > > +find_memory_area(struct usb_dev_state *ps, const struct > > usbdevfs_urb *uurb) > > > +{ > > > + struct usb_memory *usbm = NULL, *iter; > > > + unsigned long flags; > > > + unsigned long uurb_start = (unsigned long)uurb->buffer; > > > + > > > + spin_lock_irqsave(&ps->lock, flags); > > > + list_for_each_entry(iter, &ps->memory_list, memlist) { > > > + if (iter->usb_use_count == 0 && > > > > I don't think this is necessary. It should be legal to keep the data > > for two URBs in the same memory region, so long as they don't overlap. > > Hi, > > they also must not share cache lines. How do you guarantee that in this > case? I can't guarantee it -- that's the responsibility of the user program. If it wants to put two transfer buffers in the same memory region, it should know about the potential problems. Besides, if we use dma_zalloc_coherent() to allocate the memory then the problem doesn't arise. Coherent memory can safely be accessed by both the device and the CPU at any time, by definition, without regard for caching. 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