From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Ira W. Snyder" <iws@ovro.caltech.edu>
Cc: netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, mingo@elte.hu, linux-mm@kvack.org,
akpm@linux-foundation.org, hpa@zytor.com,
gregory.haskins@gmail.com, Rusty Russell <rusty@rustcorp.com.au>,
s.hetze@linux-ag.com
Subject: Re: [PATCHv5 3/3] vhost_net: a kernel-level virtio server
Date: Tue, 8 Sep 2009 23:14:28 +0300 [thread overview]
Message-ID: <20090908201428.GA12420@redhat.com> (raw)
In-Reply-To: <20090908172035.GB319@ovro.caltech.edu>
On Tue, Sep 08, 2009 at 10:20:35AM -0700, Ira W. Snyder wrote:
> On Mon, Sep 07, 2009 at 01:15:37PM +0300, Michael S. Tsirkin wrote:
> > On Thu, Sep 03, 2009 at 11:39:45AM -0700, Ira W. Snyder wrote:
> > > On Thu, Aug 27, 2009 at 07:07:50PM +0300, Michael S. Tsirkin wrote:
> > > > What it is: vhost net is a character device that can be used to reduce
> > > > the number of system calls involved in virtio networking.
> > > > Existing virtio net code is used in the guest without modification.
> > > >
> > > > There's similarity with vringfd, with some differences and reduced scope
> > > > - uses eventfd for signalling
> > > > - structures can be moved around in memory at any time (good for migration)
> > > > - support memory table and not just an offset (needed for kvm)
> > > >
> > > > common virtio related code has been put in a separate file vhost.c and
> > > > can be made into a separate module if/when more backends appear. I used
> > > > Rusty's lguest.c as the source for developing this part : this supplied
> > > > me with witty comments I wouldn't be able to write myself.
> > > >
> > > > What it is not: vhost net is not a bus, and not a generic new system
> > > > call. No assumptions are made on how guest performs hypercalls.
> > > > Userspace hypervisors are supported as well as kvm.
> > > >
> > > > How it works: Basically, we connect virtio frontend (configured by
> > > > userspace) to a backend. The backend could be a network device, or a
> > > > tun-like device. In this version I only support raw socket as a backend,
> > > > which can be bound to e.g. SR IOV, or to macvlan device. Backend is
> > > > also configured by userspace, including vlan/mac etc.
> > > >
> > > > Status:
> > > > This works for me, and I haven't see any crashes.
> > > > I have done some light benchmarking (with v4), compared to userspace, I
> > > > see improved latency (as I save up to 4 system calls per packet) but not
> > > > bandwidth/CPU (as TSO and interrupt mitigation are not supported). For
> > > > ping benchmark (where there's no TSO) troughput is also improved.
> > > >
> > > > Features that I plan to look at in the future:
> > > > - tap support
> > > > - TSO
> > > > - interrupt mitigation
> > > > - zero copy
> > > >
> > >
> > > Hello Michael,
> > >
> > > I've started looking at vhost with the intention of using it over PCI to
> > > connect physical machines together.
> > >
> > > The part that I am struggling with the most is figuring out which parts
> > > of the rings are in the host's memory, and which parts are in the
> > > guest's memory.
> >
> > All rings are in guest's memory, to match existing virtio code.
>
> Ok, this makes sense.
>
> > vhost
> > assumes that the memory space of the hypervisor userspace process covers
> > the whole of guest memory.
>
> Is this necessary? Why?
Because with virtio ring can give us arbitrary guest addresses. If
guest was limited to using a subset of addresses, hypervisor would only
have to map these.
> The assumption seems very wrong when you're
> doing data transport between two physical systems via PCI.
> I know vhost has not been designed for this specific situation, but it
> is good to be looking toward other possible uses.
>
> > And there's a translation table.
> > Ring addresses are userspace addresses, they do not undergo translation.
> >
> > > If I understand everything correctly, the rings are all userspace
> > > addresses, which means that they can be moved around in physical memory,
> > > and get pushed out to swap.
> >
> > Unless they are locked, yes.
> >
> > > AFAIK, this is impossible to handle when
> > > connecting two physical systems, you'd need the rings available in IO
> > > memory (PCI memory), so you can ioreadXX() them instead. To the best of
> > > my knowledge, I shouldn't be using copy_to_user() on an __iomem address.
> > > Also, having them migrate around in memory would be a bad thing.
> > >
> > > Also, I'm having trouble figuring out how the packet contents are
> > > actually copied from one system to the other. Could you point this out
> > > for me?
> >
> > The code in net/packet/af_packet.c does it when vhost calls sendmsg.
> >
>
> Ok. The sendmsg() implementation uses memcpy_fromiovec(). Is it possible
> to make this use a DMA engine instead?
Maybe.
> I know this was suggested in an earlier thread.
Yes, it might even give some performance benefit with e.g. I/O AT.
> > > Is there somewhere I can find the userspace code (kvm, qemu, lguest,
> > > etc.) code needed for interacting with the vhost misc device so I can
> > > get a better idea of how userspace is supposed to work?
> >
> > Look in archives for kvm@vger.kernel.org. the subject is qemu-kvm: vhost net.
> >
> > > (Features
> > > negotiation, etc.)
> > >
> >
> > That's not yet implemented as there are no features yet. I'm working on
> > tap support, which will add a feature bit. Overall, qemu does an ioctl
> > to query supported features, and then acks them with another ioctl. I'm
> > also trying to avoid duplicating functionality available elsewhere. So
> > that to check e.g. TSO support, you'd just look at the underlying
> > hardware device you are binding to.
> >
>
> Ok. Do you have plans to support the VIRTIO_NET_F_MRG_RXBUF feature in
> the future? I found that this made an enormous improvement in throughput
> on my virtio-net <-> virtio-net system. Perhaps it isn't needed with
> vhost-net.
Yes, I'm working on it.
> Thanks for replying,
> Ira
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-09-08 20:14 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1251388414.git.mst@redhat.com>
2009-08-27 16:06 ` [PATCHv5 1/3] mm: export use_mm/unuse_mm to modules Michael S. Tsirkin
2009-08-28 15:31 ` Gregory Haskins
2009-08-27 16:07 ` [PATCHv5 2/3] mm: reduce atomic use on use_mm fast path Michael S. Tsirkin
2009-08-27 16:07 ` [PATCHv5 3/3] vhost_net: a kernel-level virtio server Michael S. Tsirkin
2009-09-03 18:39 ` Ira W. Snyder
2009-09-07 10:15 ` Michael S. Tsirkin
2009-09-08 17:20 ` Ira W. Snyder
2009-09-08 20:14 ` Michael S. Tsirkin [this message]
2009-09-11 15:17 ` Xin, Xiaohui
2009-09-13 5:46 ` Michael S. Tsirkin
2009-09-14 5:57 ` Xin, Xiaohui
2009-09-14 7:05 ` Michael S. Tsirkin
2009-09-11 16:00 ` Gregory Haskins
2009-09-11 16:14 ` Gregory Haskins
2009-09-13 12:01 ` Michael S. Tsirkin
2009-09-14 16:08 ` Gregory Haskins
2009-09-14 16:47 ` Michael S. Tsirkin
2009-09-14 19:14 ` Gregory Haskins
2009-09-15 12:35 ` Avi Kivity
2009-09-15 13:03 ` Gregory Haskins
2009-09-15 13:25 ` Avi Kivity
2009-09-15 13:50 ` Gregory Haskins
2009-09-15 14:28 ` Michael S. Tsirkin
2009-09-15 15:03 ` Avi Kivity
2009-09-15 20:08 ` Gregory Haskins
2009-09-15 20:40 ` Michael S. Tsirkin
2009-09-15 20:43 ` Gregory Haskins
2009-09-15 21:25 ` Michael S. Tsirkin
2009-09-15 21:39 ` Gregory Haskins
2009-09-15 21:38 ` Michael S. Tsirkin
2009-09-15 21:55 ` Gregory Haskins
2009-09-16 14:57 ` Arnd Bergmann
2009-09-16 15:13 ` Michael S. Tsirkin
2009-09-16 15:22 ` Arnd Bergmann
2009-09-16 16:08 ` Michael S. Tsirkin
2009-09-16 8:23 ` Avi Kivity
2009-09-16 11:44 ` Gregory Haskins
2009-09-16 13:05 ` Avi Kivity
2009-09-16 14:10 ` Gregory Haskins
2009-09-16 15:59 ` Avi Kivity
2009-09-16 19:22 ` Gregory Haskins
2009-09-16 21:00 ` Avi Kivity
2009-09-17 3:11 ` Gregory Haskins
2009-09-17 7:49 ` Avi Kivity
2009-09-17 14:16 ` Javier Guerra
2009-09-21 21:43 ` Ira W. Snyder
2009-09-22 9:43 ` Avi Kivity
2009-09-22 15:25 ` Ira W. Snyder
2009-09-22 15:56 ` Avi Kivity
2009-09-23 14:26 ` Gregory Haskins
2009-09-23 14:37 ` Avi Kivity
2009-09-23 15:10 ` Gregory Haskins
2009-09-23 17:58 ` Gregory Haskins
2009-09-23 19:37 ` Avi Kivity
2009-09-23 21:15 ` Gregory Haskins
2009-09-24 7:18 ` Avi Kivity
2009-09-24 18:03 ` Gregory Haskins
2009-09-25 8:22 ` Avi Kivity
2009-09-25 21:32 ` Gregory Haskins
2009-09-27 9:43 ` Avi Kivity
2009-09-30 20:04 ` Gregory Haskins
2009-10-01 8:34 ` Avi Kivity
2009-10-01 9:28 ` Michael S. Tsirkin
2009-10-01 19:24 ` Gregory Haskins
2009-10-03 10:00 ` Avi Kivity
2009-09-24 19:27 ` Ira W. Snyder
2009-09-25 7:43 ` Avi Kivity
2009-09-24 8:03 ` Avi Kivity
2009-09-24 18:04 ` Gregory Haskins
2009-09-17 3:57 ` Michael S. Tsirkin
2009-09-17 4:13 ` Gregory Haskins
2009-09-15 12:32 ` Avi Kivity
2009-09-14 16:53 ` Michael S. Tsirkin
2009-09-14 19:28 ` Gregory Haskins
2009-09-25 17:01 ` Ira W. Snyder
2009-09-27 7:43 ` Michael S. Tsirkin
[not found] <E88DD564E9DC5446A76B2B47C3BCCA150219600F9B@pdsmsx503.ccr.corp.intel.com>
2009-08-31 11:42 ` Xin, Xiaohui
2009-08-31 15:23 ` Arnd Bergmann
2009-09-01 14:58 ` Xin, Xiaohui
2009-08-31 17:52 ` Avi Kivity
2009-08-31 21:56 ` Anthony Liguori
2009-09-01 15:37 ` Xin, Xiaohui
2009-09-01 5:04 ` Xin, Xiaohui
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=20090908201428.GA12420@redhat.com \
--to=mst@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=gregory.haskins@gmail.com \
--cc=hpa@zytor.com \
--cc=iws@ovro.caltech.edu \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=s.hetze@linux-ag.com \
--cc=virtualization@lists.linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).