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,
int vlan,
int bootindex,
bool multiqueue,
int vhostfdSize,
virQEMUCapsPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@ -5035,8 +5035,11 @@ qemuBuildNicDevStr(virDomainDefPtr def,
virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx));
}
}
if (usingVirtio && multiqueue)
virBufferAddLit(&buf, ",mq=on");
if (usingVirtio && vhostfdSize > 1) {
/* 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)
virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias);
else
@ -7591,10 +7594,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
virCommandAddArgList(cmd, "-netdev", host, NULL);
}
if (qemuDomainSupportsNicdev(def, qemuCaps, net)) {
bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
multiqueue, qemuCaps)))
vhostfdSize, qemuCaps)))
goto cleanup;
virCommandAddArgList(cmd, "-device", nic, NULL);
} else {

View File

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

View File

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