public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: splice() based interguest networking
Date: Mon, 01 Dec 2008 13:33:13 -0600	[thread overview]
Message-ID: <49343BF9.30308@us.ibm.com> (raw)

Here's a random thought I had after seeing the new Xen netchannel2 tree 
had fast-path support for guest<=>guest communication.

With virtio, we could do really fast interguest networking in 
userspace.  We have a few requirements though:

1) There should be a minimal number of copies, just one in almost all cases.
2) The copy should occur on the receiving end since the receiver is most 
likely going to be accessing the data in the future
3) The copy should be done in the kernel so that in the future it could 
be accelerated with a generic DMA engine.

So far, all the approaches required mmap()'ing the guest memory in both 
QEMU instances which makes it much less useful.  I think splice solves 
this problem though and gets us most of the above for free.

If we have two shared pipes() between the two QEMU processes, then:

1) On TX, we vmsplice() from the sg buffer to one pipe.  This will end 
up being vmsplice_to_pipe() in the kernel which is zero-copy.

2) The pipe becomes readable which will result in an RX notification in 
the other process, we see if we have any buffers available in the 
receive queue.  If so, we vmsplice() from the pipe to the sg buffer.  
This will result in a copy via vmsplice_to_user().  In the future, 
vmsplice_to_user() would be an obvious candidate for IO-AT acceleration.

Since the copy is happening in the kernel, assuming you're not in a 
highmem situation, no page table manipulation is required.

We still have to address feature negotation and such.

Regards,

Anthony Liguori

             reply	other threads:[~2008-12-01 19:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 19:33 Anthony Liguori [this message]
2008-12-02 12:18 ` splice() based interguest networking Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49343BF9.30308@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox