From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mike D. Day" Subject: Re: [PATCH 1/9] Xen Share: Simplified I/O Mechanism Date: Wed, 14 Jun 2006 13:46:37 -0400 Message-ID: <44904B7D.8070802@us.ibm.com> References: <1149572143.5183.25.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1149572143.5183.25.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Rusty Russell Cc: Xen Mailing List List-Id: xen-devel@lists.xenproject.org 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);