On Sun, Sep 29, 2013 at 4:24 PM, Ming Lei <tom.leiming@xxxxxxxxx> wrote: > On Sun, Sep 29, 2013 at 10:02 PM, Markus Rechberger > <mrechberger@xxxxxxxxx> wrote: >> This patch adds memory mapping support to USBFS for isochronous and bulk >> data transfers, it allows to pre-allocate usb transfer buffers. >> >> The CPU usage decreases 1-2% on my 1.3ghz U7300 notebook >> The CPU usage decreases 6-8% on an Intel Atom n270 when >> transferring 20mbyte/sec (isochronous), it should be more interesting to >> see those >> statistics on embedded systems where copying data is more expensive. > > X86 platform should be memory coherent, which means uncached mapping > might not affect memory access performance from CPU, so you might need > provide performance data on other non-coherent ARCH. > >> Usage from userspace: >> allocation: >> rv = ioctl(priv->usbfd, USBDEVFS_ALLOC_MEMORY, &mem); >> if (rv == 0) >> buffer = mmap(NULL, size, PROT_READ|PROT_WRITE, >> MAP_SHARED, priv->usbfd, mem.offset); >> use the mapped buffer with urb->buffer. >> release: >> rv = munmap(buffer, size); >> memset(&mem, 0x0, sizeof(struct usbdevfs_memory)); >> mem.buffer = buffer; >> rv = ioctl(priv->usbfd, USBDEVFS_RELEASE_MEMORY, &mem); >> >> non freed memory buffers are collected and will be released when closing >> the node. >> >> I tested this patch with Bulk and Isochronous, with and without memory >> mapping (applications which don't use mmap will just fall back to the >> legacy mechanism). >> >> Version 0.3: >> * Removed comment >> * Renamed USBDEVFS_FREE_MEMORY to USBDEVFS_RELEASE_MEMORY >> * Clearing allocated memory >> >> Version 0.4: >> * overriding SG transfers once memory mapped buffers are allocated for >> BULK > > Why do you want to override SG transfer? > please read up the previous emails to the mailinglist I provided a bunch of links with bugreports. >> * adding pgprot_noncached to ensure that the IO memory is not cached > > Accessing non-cached mapping on some ARCHs is extremely slow, so I > an wondering if it is good way to map the area as non-cached. > > > Thanks, > -- > Ming Lei -- 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