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

Re: [Xen-devel] [PATCH 1/9] Xen Share: Simplified I/O Mechanism

Rusty Russell wrote:
Finally, a scatter-gather list mechanism allows the domains to
associate their pages with arbitrary queue numbers in the shared
region, to transport bulk data (effectively by having the hypervisor
do "DMA" between domains).

The sg transfer mechanism avoids bounce buffers and does a straight copy from_user or to_user below. So this is an alternative to page flipping, right? It would be interesting to see how the direct copy performs compared to page flipping on various architectures. Page table updates are not free and processors are getting more efficient at bulk dma.

> +/* Copy from src to dst, return amount copied. */
+static int do_copy(const struct sg_list *sgdst, const struct sg_list *sgsrc,
+                  unsigned long (*copy)(paddr_t, paddr_t, unsigned long))
+       unsigned long totlen, src, dst, srcoff, dstoff;
+       int ret = 0;
+       totlen = 0;
+       src = dst = 0;
+       srcoff = dstoff = 0;
+       while (src < sgsrc->num_sg) {
+               unsigned long len;
+               len = min(sgsrc->sg[src].len - srcoff,
+                         sgdst->sg[dst].len - dstoff);
+               len = copy(sgdst->sg[dst].addr+dstoff,
+                          sgsrc->sg[src].addr+srcoff,
+                          len);

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.