Re: Infrastructure for zerocopy I/O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2015-11-17 at 14:13 -0500, Alan Stern wrote:
> On Tue, 17 Nov 2015, Steinar H. Gunderson wrote:
> 

> > Alan, could we perhaps let the zerocopy flag make the request fail (instead
> > of going through a bounce buffer) if direct DMA is not possible? That way,
> > it would be quite obvious that you need to allocate the memory some other way
> > instead of silently hitting the issues Markus mention.
> 
> But what other way of allocating memory is there?

mmap() if you mean in user space.
In kernel space there is GFP_DMA32. Thus in the kernel the problem
is solved if you disregard controllers that can do only less than
32 bit (We could fall back to GFP_DMA, but the buffers would have to be
tiny)
So the issue is getting the buffer to the user. mmap() can do
that.

> With scatter-gather lists, fragmentation isn't an issue.  But bounce
> buffers are unavoidable if the memory isn't accessible to the USB
> hardware.

True and therefore therefore you cannot do the allocation before
you tell the kernel what you need the memory for. Hence it seems
to me that if you want to do it without an IOMMU, mmap() is the only
generic option. It implicitly tells the kernel what the memory is
for by being tied to a device.

	Regards
		Oliver



--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux