1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemuBuildNicDevStr: Set vectors= on Multiqueue

Yet another advice appeared on the Multiqueue wiki page:

http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature

We should add vectors=N onto the qemu command line, where
N = 2 * (number of queues) + 1.
This commit is contained in:
Michal Privoznik 2013-08-23 09:48:24 +02:00
parent 097c9b52f4
commit 4f588a1b46
3 changed files with 9 additions and 10 deletions

View File

@ -4980,7 +4980,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
virDomainNetDefPtr net, virDomainNetDefPtr net,
int vlan, int vlan,
int bootindex, int bootindex,
bool multiqueue, int vhostfdSize,
virQEMUCapsPtr qemuCaps) virQEMUCapsPtr qemuCaps)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
@ -5035,8 +5035,11 @@ qemuBuildNicDevStr(virDomainDefPtr def,
virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx)); virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx));
} }
} }
if (usingVirtio && multiqueue) if (usingVirtio && vhostfdSize > 1) {
virBufferAddLit(&buf, ",mq=on"); /* As advised at http://www.linux-kvm.org/page/Multiqueue
* we should add vectors=2*N+1 where N is the vhostfdSize */
virBufferAsprintf(&buf, ",mq=on,vectors=%d", 2 * vhostfdSize + 1);
}
if (vlan == -1) if (vlan == -1)
virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias); virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias);
else else
@ -7591,10 +7594,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
virCommandAddArgList(cmd, "-netdev", host, NULL); virCommandAddArgList(cmd, "-netdev", host, NULL);
} }
if (qemuDomainSupportsNicdev(def, qemuCaps, net)) { if (qemuDomainSupportsNicdev(def, qemuCaps, net)) {
bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex, if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
multiqueue, qemuCaps))) vhostfdSize, qemuCaps)))
goto cleanup; goto cleanup;
virCommandAddArgList(cmd, "-device", nic, NULL); virCommandAddArgList(cmd, "-device", nic, NULL);
} else { } else {

View File

@ -105,7 +105,7 @@ char * qemuBuildNicDevStr(virDomainDefPtr def,
virDomainNetDefPtr net, virDomainNetDefPtr net,
int vlan, int vlan,
int bootindex, int bootindex,
bool multiqueue, int vhostfdSize,
virQEMUCapsPtr qemuCaps); virQEMUCapsPtr qemuCaps);
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk, char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,

View File

@ -998,10 +998,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
} }
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0, if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
multiqueue, priv->qemuCaps))) vhostfdSize, priv->qemuCaps)))
goto try_remove; goto try_remove;
} else { } else {
if (!(nicstr = qemuBuildNicStr(net, NULL, vlan))) if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))