Anthony Liguori <anthony at codemonkey.ws> writes:> Rusty Russell <rusty at rustcorp.com.au> writes: >> On Fri, May 24, 2013 at 08:47:58AM -0500, Anthony Liguori wrote: >>> FWIW, I think what's more interesting is using vhost-net as a networking >>> backend with virtio-net in QEMU being what's guest facing. >>> >>> In theory, this gives you the best of both worlds: QEMU acts as a first >>> line of defense against a malicious guest while still getting the >>> performance advantages of vhost-net (zero-copy). >>> >> It would be an interesting idea if we didn't already have the vhost >> model where we don't need the userspace bounce. > > The model is very interesting for QEMU because then we can use vhost as > a backend for other types of network adapters (like vmxnet3 or even > e1000). > > It also helps for things like fault tolerance where we need to be able > to control packet flow within QEMU.(CC's reduced, context added, Dmitry Fleytman added for vmxnet3 thoughts). Then I'm really confused as to what this would look like. A zero copy sendmsg? We should be able to implement that today. On the receive side, what can we do better than readv? If we need to return to userspace to tell the guest that we've got a new packet, we don't win on latency. We might reduce syscall overhead with a multi-dimensional readv to read multiple packets at once? Confused, Rusty.
On Thu, May 30, 2013 at 7:23 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:> Anthony Liguori <anthony at codemonkey.ws> writes: >> Rusty Russell <rusty at rustcorp.com.au> writes: >>> On Fri, May 24, 2013 at 08:47:58AM -0500, Anthony Liguori wrote: >>>> FWIW, I think what's more interesting is using vhost-net as a networking >>>> backend with virtio-net in QEMU being what's guest facing. >>>> >>>> In theory, this gives you the best of both worlds: QEMU acts as a first >>>> line of defense against a malicious guest while still getting the >>>> performance advantages of vhost-net (zero-copy). >>>> >>> It would be an interesting idea if we didn't already have the vhost >>> model where we don't need the userspace bounce. >> >> The model is very interesting for QEMU because then we can use vhost as >> a backend for other types of network adapters (like vmxnet3 or even >> e1000). >> >> It also helps for things like fault tolerance where we need to be able >> to control packet flow within QEMU. > > (CC's reduced, context added, Dmitry Fleytman added for vmxnet3 thoughts). > > Then I'm really confused as to what this would look like. A zero copy > sendmsg? We should be able to implement that today. > > On the receive side, what can we do better than readv? If we need to > return to userspace to tell the guest that we've got a new packet, we > don't win on latency. We might reduce syscall overhead with a > multi-dimensional readv to read multiple packets at once?Sounds like recvmmsg(2). Stefan
Stefan Hajnoczi <stefanha at gmail.com> writes:> On Thu, May 30, 2013 at 7:23 AM, Rusty Russell <rusty at rustcorp.com.au> wrote: >> On the receive side, what can we do better than readv? If we need to >> return to userspace to tell the guest that we've got a new packet, we >> don't win on latency. We might reduce syscall overhead with a >> multi-dimensional readv to read multiple packets at once? > > Sounds like recvmmsg(2).Wow... the future is here, today! Thanks, Rusty.
Rusty Russell <rusty at rustcorp.com.au> writes:> Anthony Liguori <anthony at codemonkey.ws> writes: >> Rusty Russell <rusty at rustcorp.com.au> writes: >>> On Fri, May 24, 2013 at 08:47:58AM -0500, Anthony Liguori wrote: >>>> FWIW, I think what's more interesting is using vhost-net as a networking >>>> backend with virtio-net in QEMU being what's guest facing. >>>> >>>> In theory, this gives you the best of both worlds: QEMU acts as a first >>>> line of defense against a malicious guest while still getting the >>>> performance advantages of vhost-net (zero-copy). >>>> >>> It would be an interesting idea if we didn't already have the vhost >>> model where we don't need the userspace bounce. >> >> The model is very interesting for QEMU because then we can use vhost as >> a backend for other types of network adapters (like vmxnet3 or even >> e1000). >> >> It also helps for things like fault tolerance where we need to be able >> to control packet flow within QEMU. > > (CC's reduced, context added, Dmitry Fleytman added for vmxnet3 thoughts). > > Then I'm really confused as to what this would look like. A zero copy > sendmsg? We should be able to implement that today.The only trouble with sendmsg would be doing batch submission and asynchronous completion. A thread pool could certainly be used for this I guess. Regards, Anthony Liguori> On the receive side, what can we do better than readv? If we need to > return to userspace to tell the guest that we've got a new packet, we > don't win on latency. We might reduce syscall overhead with a > multi-dimensional readv to read multiple packets at once? > > Confused, > Rusty.
Stefan Hajnoczi <stefanha at gmail.com> writes:> On Thu, May 30, 2013 at 7:23 AM, Rusty Russell <rusty at rustcorp.com.au> wrote: >> Anthony Liguori <anthony at codemonkey.ws> writes: >>> Rusty Russell <rusty at rustcorp.com.au> writes: >>>> On Fri, May 24, 2013 at 08:47:58AM -0500, Anthony Liguori wrote: >>>>> FWIW, I think what's more interesting is using vhost-net as a networking >>>>> backend with virtio-net in QEMU being what's guest facing. >>>>> >>>>> In theory, this gives you the best of both worlds: QEMU acts as a first >>>>> line of defense against a malicious guest while still getting the >>>>> performance advantages of vhost-net (zero-copy). >>>>> >>>> It would be an interesting idea if we didn't already have the vhost >>>> model where we don't need the userspace bounce. >>> >>> The model is very interesting for QEMU because then we can use vhost as >>> a backend for other types of network adapters (like vmxnet3 or even >>> e1000). >>> >>> It also helps for things like fault tolerance where we need to be able >>> to control packet flow within QEMU. >> >> (CC's reduced, context added, Dmitry Fleytman added for vmxnet3 thoughts). >> >> Then I'm really confused as to what this would look like. A zero copy >> sendmsg? We should be able to implement that today. >> >> On the receive side, what can we do better than readv? If we need to >> return to userspace to tell the guest that we've got a new packet, we >> don't win on latency. We might reduce syscall overhead with a >> multi-dimensional readv to read multiple packets at once? > > Sounds like recvmmsg(2).Could we map this to mergable rx buffers though? Regards, Anthony Liguori> > Stefan