Discussion:
[libvirt] question for <interface> in ethernet type and multiple queues in KVM (start VM failed)
Wangrui (K)
2014-03-26 08:59:04 UTC
Permalink
Hi,

I use ethernet vif for VM (libvirt 1.1.0 qemu 1.5.1). xml as such

<interface type='ethernet'>
<script path='' />
<target dev='tap_mq'/>
<mac address='52:54:00:19:9e:4e'/>
<model type='virtio' />
<driver name='vhost' queues='2'/>
</interface>

tap_mq is a tap device with multi_queue property which was created on host by ip command, such as follows
#ip tuntap add tap_mq mode tap multi_queue

I want to use multiple queue feature for this vif so I set queues='2' in xml.

When start VM , an error occurs
"error: unsupported configuration: Multiqueue network is not supported for: ethernet".
This error is reported from function qemuBuildInterfaceCommandLine

/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported for: %s"),
virDomainNetTypeToString(actualType));
return -1;
}

The comment specifies that only TAP device supports multiqueue. But VIR_DOMAIN_NET_TYPE_ETHERNET is also TAP device I think.

IMHO, libvirt can build qemu commandline as
"-device virtio-net,netdev=net1,mq=on,vectors=5,mac=52:54:00:19:9e:4e"
"-netdev type=tap,ifname=tap0,id=net1,vhost=on,vhostforce=on,queues=2".
Qemu can open tapfds and vhostfds by itself other than libvirt opens and transfers them to qemu in this case.

Or there's other way to use multiqueue feature in ethernet tpye ?

Regards,
Rui
Michal Privoznik
2014-03-26 09:16:00 UTC
Permalink
Post by Wangrui (K)
Hi,
I use ethernet vif for VM (libvirt 1.1.0 qemu 1.5.1). xml as such
<interface type='ethernet'>
<script path='' />
<target dev='tap_mq'/>
<mac address='52:54:00:19:9e:4e'/>
<model type='virtio' />
<driver name='vhost' queues='2'/>
</interface>
tap_mq is a tap device with multi_queue property which was created on host by ip command, such as follows
#ip tuntap add tap_mq mode tap multi_queue
I want to use multiple queue feature for this vif so I set queues='2' in xml.
When start VM , an error occurs
"error: unsupported configuration: Multiqueue network is not supported for: ethernet".
This error is reported from function qemuBuildInterfaceCommandLine
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported for: %s"),
virDomainNetTypeToString(actualType));
return -1;
}
The comment specifies that only TAP device supports multiqueue. But VIR_DOMAIN_NET_TYPE_ETHERNET is also TAP device I think.
Even though the device is TAP device indeed, it's not from the libvirt
POV. Libvirt doesn't examine the target dev to see if it is TAP,
physical NIC, sit, ... whatever.

As always, patches are welcome :)

Michal
Gonglei (Arei)
2014-03-26 09:31:17 UTC
Permalink
Post by Wangrui (K)
Post by Wangrui (K)
I use ethernet vif for VM (libvirt 1.1.0 qemu 1.5.1). xml as such
<interface type='ethernet'>
<script path='' />
<target dev='tap_mq'/>
<mac address='52:54:00:19:9e:4e'/>
<model type='virtio' />
<driver name='vhost' queues='2'/>
</interface>
tap_mq is a tap device with multi_queue property which was created
on host by ip command, such as follows
Post by Wangrui (K)
#ip tuntap add tap_mq mode tap multi_queue
I want to use multiple queue feature for this vif so I set queues='2' in
xml.
Post by Wangrui (K)
When start VM , an error occurs
"error: unsupported configuration: Multiqueue network is not
supported for: ethernet".
Post by Wangrui (K)
This error is reported from function qemuBuildInterfaceCommandLine
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported
for: %s"),
Post by Wangrui (K)
virDomainNetTypeToString(actualType));
return -1;
}
The comment specifies that only TAP device supports multiqueue. But
VIR_DOMAIN_NET_TYPE_ETHERNET is also TAP device I think.
Even though the device is TAP device indeed, it's not from the libvirt
POV. Libvirt doesn't examine the target dev to see if it is TAP,
physical NIC, sit, ... whatever.
Yep, but I think libvirt should provide this ability which process multi_queue of ethernet type.
And the result is guaranteed by the emulator, such as Qemu.
Post by Wangrui (K)
As always, patches are welcome :)
Michal
Best regards,
-Gonglei
Daniel P. Berrange
2014-03-26 09:57:43 UTC
Permalink
Post by Gonglei (Arei)
Post by Wangrui (K)
Post by Wangrui (K)
I use ethernet vif for VM (libvirt 1.1.0 qemu 1.5.1). xml as such
<interface type='ethernet'>
<script path='' />
<target dev='tap_mq'/>
<mac address='52:54:00:19:9e:4e'/>
<model type='virtio' />
<driver name='vhost' queues='2'/>
</interface>
tap_mq is a tap device with multi_queue property which was created
on host by ip command, such as follows
Post by Wangrui (K)
#ip tuntap add tap_mq mode tap multi_queue
I want to use multiple queue feature for this vif so I set queues='2' in
xml.
Post by Wangrui (K)
When start VM , an error occurs
"error: unsupported configuration: Multiqueue network is not
supported for: ethernet".
Post by Wangrui (K)
This error is reported from function qemuBuildInterfaceCommandLine
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported
for: %s"),
Post by Wangrui (K)
virDomainNetTypeToString(actualType));
return -1;
}
The comment specifies that only TAP device supports multiqueue. But
VIR_DOMAIN_NET_TYPE_ETHERNET is also TAP device I think.
Even though the device is TAP device indeed, it's not from the libvirt
POV. Libvirt doesn't examine the target dev to see if it is TAP,
physical NIC, sit, ... whatever.
Yep, but I think libvirt should provide this ability which process
multi_queue of ethernet type. And the result is guaranteed by the
emulator, such as Qemu.
Really you'd be better off not using type=ethernet at all. If there is
something preventing you doing that, then it would be a better use of
time to solve that rather than add more features to type=ethernet
which we don't want anyone to have to use.

Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Daniel P. Berrange
2014-03-26 09:55:37 UTC
Permalink
Post by Wangrui (K)
Hi,
I use ethernet vif for VM (libvirt 1.1.0 qemu 1.5.1). xml as such
<interface type='ethernet'>
<script path='' />
<target dev='tap_mq'/>
<mac address='52:54:00:19:9e:4e'/>
<model type='virtio' />
<driver name='vhost' queues='2'/>
</interface>
tap_mq is a tap device with multi_queue property which was created on host by ip command, such as follows
#ip tuntap add tap_mq mode tap multi_queue
I want to use multiple queue feature for this vif so I set queues='2' in xml.
When start VM , an error occurs
"error: unsupported configuration: Multiqueue network is not supported for: ethernet".
This error is reported from function qemuBuildInterfaceCommandLine
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported for: %s"),
virDomainNetTypeToString(actualType));
return -1;
}
The comment specifies that only TAP device supports multiqueue. But
VIR_DOMAIN_NET_TYPE_ETHERNET is also TAP device I think.
No, libvirt can't assume that - it just knows it is something that /looks/
like a tap device but it might not be. This is just an example of one of
the many problems with type=ethernet and why we recommend people never
to use this & why its taints any domain using it.


Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Loading...