From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzOby-0002nF-RK for qemu-devel@nongnu.org; Thu, 09 Aug 2012 05:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzObu-0002H3-TO for qemu-devel@nongnu.org; Thu, 09 Aug 2012 05:00:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzObu-0002GI-Lp for qemu-devel@nongnu.org; Thu, 09 Aug 2012 05:00:54 -0400 Date: Thu, 9 Aug 2012 14:30:15 +0530 From: Amit Shah Message-ID: <20120809090015.GG3280@amit.redhat.com> References: <20120724023657.6600.52706.stgit@ltc189.sdl.hitachi.co.jp> <20120724023707.6600.69536.stgit@ltc189.sdl.hitachi.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120724023707.6600.69536.stgit@ltc189.sdl.hitachi.co.jp> Subject: Re: [Qemu-devel] [RFC PATCH 1/6] virtio/console: Add splice_write support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yoshihiro YUNOMAE Cc: Arnd Bergmann , qemu-devel@nongnu.org, Frederic Weisbecker , yrl.pp-manager.tt@hitachi.com, linux-kernel@vger.kernel.org, Borislav Petkov , virtualization@lists.linux-foundation.org, Herbert Xu , "Franch Ch. Eigler" , Ingo Molnar , Mathieu Desnoyers , Steven Rostedt , Anthony Liguori , Greg Kroah-Hartman , Masami Hiramatsu On (Tue) 24 Jul 2012 [11:37:07], Yoshihiro YUNOMAE wrote: > From: Masami Hiramatsu > > Enable to use splice_write from pipe to virtio-console port. > This steals pages from pipe and directly send it to host. > > Note that this may accelerate only the guest to host path. > > Signed-off-by: Masami Hiramatsu > Cc: Amit Shah > Cc: Arnd Bergmann > Cc: Greg Kroah-Hartman > --- > +/* Faster zero-copy write by splicing */ > +static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, > + struct file *filp, loff_t *ppos, > + size_t len, unsigned int flags) > +{ > + struct port *port = filp->private_data; > + struct sg_list sgl; > + ssize_t ret; > + struct splice_desc sd = { > + .total_len = len, > + .flags = flags, > + .pos = *ppos, > + .u.data = &sgl, > + }; > + > + sgl.n = 0; > + sgl.len = 0; > + sgl.sg = kmalloc(sizeof(struct scatterlist) * MAX_SPLICE_PAGES, > + GFP_ATOMIC); Do you expect this function to be called from interrupt context? > + if (unlikely(!sgl.sg)) > + return -ENOMEM; > + > + sg_init_table(sgl.sg, MAX_SPLICE_PAGES); > + ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); > + if (likely(ret > 0)) > + ret = send_pages(port, sgl.sg, sgl.n, sgl.len, true); > + > + return ret; > +} Amit