[libvirt] [PATCH 8/9] qemu: Only setup vhost if virtType == "kvm"

Michael S. Tsirkin mst at redhat.com
Thu Aug 1 08:02:32 UTC 2013


On Thu, Aug 01, 2013 at 03:06:41AM -0400, Laine Stump wrote:
> On 07/31/2013 10:14 PM, Cole Robinson wrote:
> > vhost only works in KVM mode AIUI,
> 
> What's your definition of "AIUI"? :-) That makes sense, but in case you
> haven't yet asked MST, I'm CC'ing him to get it straight from the
> source. MST?
> 
> 
> If that's true, then ACK (and we might want to backport this to some
> older releases)

That's true at the moment but I'm not sure about the future:
fundamentally there's nothing kvm specific in vhost,
it's just that qemu doesn't yet support ioeventfd
and irqfd without kvm.

So I think we really should design something to detect
whether vhost-net is supported, I will look into this.

It's up to you guys whether to wait for that
and look into how to do this properly, or
apply this patch and re-do the change again
once qemu has this support.

> >  and is infact compiled out if
> > the emulator is built for non-native architecture.
> > ---
> >  src/qemu/qemu_command.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index 3b275e3..f611940 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -462,8 +462,10 @@ qemuOpenVhostNet(virDomainDefPtr def,
> >  {
> >      size_t i;
> >  
> > -    /* If the config says explicitly to not use vhost, return now */
> > -    if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) {
> > +    /* If running a plain QEMU guest, or
> > +     * if the config says explicitly to not use vhost, return now*/
> > +    if (def->virtType != VIR_DOMAIN_VIRT_KVM ||
> > +        net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) {
> >          *vhostfdSize = 0;
> >          return 0;
> >      }




More information about the libvir-list mailing list