From nobody Sat Apr 27 09:27:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495438261110735.0311660018366; Mon, 22 May 2017 00:31:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 432518046B; Mon, 22 May 2017 07:30:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 638695DC1D; Mon, 22 May 2017 07:30:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 01730180BAF1; Mon, 22 May 2017 07:30:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4M7UsVE016223 for ; Mon, 22 May 2017 03:30:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id EEDF04F6BB; Mon, 22 May 2017 07:30:54 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-148.phx2.redhat.com [10.3.116.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93BE15DC1D; Mon, 22 May 2017 07:30:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 432518046B Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=laine.org Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 432518046B From: Laine Stump To: libvir-list@redhat.com, berrange@redhat.com Date: Mon, 22 May 2017 03:30:48 -0400 Message-Id: <20170522073048.14386-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] Revert "qemu: propagate bridge MTU into qemu "host_mtu" option" X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 22 May 2017 07:31:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This reverts commit 2841e675. It turns out that adding the host_mtu field to the PCI capabilities in the guest bumps the length of PCI capabilities beyond the 32 byte boundary, so the virtio-net device gets 64 bytes of ioport space instead of 32, which offsets the address of all the other following devices. Migration doesn't work very well when the location and length of PCI capabilities of devices is changed between source and destination. This means that we need to make sure that the absence/presence of host_mtu on the qemu commandline always matches between source and destination, which means that we need to make setting of host_mtu an opt-in thing (it can't happen automatically when the bridge being used has a non-default MTU, which is what commit 2841e675 implemented). I do want to re-implement this feature with an setting, but probably won't backport that to any stable branches, so I'm first reverting the original commit, and that revert can be pushed to the few releases that have been made since the original (3.1.0 - 3.3.0) Resolves: https://bugzilla.redhat.com/1449346 --- src/qemu/qemu_command.c | 32 ++++++++++---------------------- src/qemu/qemu_command.h | 3 +-- src/qemu/qemu_hotplug.c | 5 ++--- src/qemu/qemu_interface.c | 5 ++--- src/qemu/qemu_interface.h | 3 +-- 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4c1a266..aa66e3d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3633,8 +3633,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, int vlan, unsigned int bootindex, size_t vhostfdSize, - virQEMUCapsPtr qemuCaps, - unsigned int mtu) + virQEMUCapsPtr qemuCaps) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; const char *nic =3D net->model; @@ -3758,23 +3757,13 @@ qemuBuildNicDevStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",rx_queue_size=3D%u", net->driver.virtio.= rx_queue_size); } =20 - if (usingVirtio && mtu) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { - - virBufferAsprintf(&buf, ",host_mtu=3D%u", mtu); - - } else { - /* log an error if mtu was requested specifically for this - * interface, otherwise, if it's just what was reported by - * the attached network, ignore it. - */ - if (net->mtu) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("setting MTU is not supported with " - "this QEMU binary")); - goto error; - } + if (usingVirtio && net->mtu) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting MTU is not supported with this QEMU = binary")); + goto error; } + virBufferAsprintf(&buf, ",host_mtu=3D%u", net->mtu); } =20 if (vlan =3D=3D -1) @@ -8320,7 +8309,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, VIR_FREE(netdev); =20 if (!(nic =3D qemuBuildNicDevStr(def, net, -1, bootindex, - queues, qemuCaps, net->mtu))) { + queues, qemuCaps))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Error generating NIC -device string")); goto error; @@ -8366,7 +8355,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, virDomainNetType actualType =3D virDomainNetGetActualType(net); virNetDevBandwidthPtr actualBandwidth; size_t i; - unsigned int mtu =3D net->mtu; =20 =20 if (!bootindex) @@ -8421,7 +8409,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, memset(tapfd, -1, tapfdSize * sizeof(tapfd[0])); =20 if (qemuInterfaceBridgeConnect(def, driver, net, - tapfd, &tapfdSize, &mtu) < 0) + tapfd, &tapfdSize) < 0) goto cleanup; break; =20 @@ -8601,7 +8589,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, } if (qemuDomainSupportsNicdev(def, net)) { if (!(nic =3D qemuBuildNicDevStr(def, net, vlan, bootindex, - vhostfdSize, qemuCaps, mtu))) + vhostfdSize, qemuCaps))) goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else { diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 7da92c8..09cb00e 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -101,8 +101,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr def, int vlan, unsigned int bootindex, size_t vhostfdSize, - virQEMUCapsPtr qemuCaps, - unsigned int mtu); + virQEMUCapsPtr qemuCaps); =20 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk); =20 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e8d2918..a1909e3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -968,7 +968,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, bool charDevPlugged =3D false; bool netdevPlugged =3D false; bool hostPlugged =3D false; - unsigned int mtu =3D net->mtu; =20 /* preallocate new slot for device */ if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0) @@ -1025,7 +1024,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto cleanup; memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceBridgeConnect(vm->def, driver, net, - tapfd, &tapfdSize, &mtu) < 0) + tapfd, &tapfdSize) < 0) goto cleanup; iface_connected =3D true; if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps, @@ -1239,7 +1238,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, VIR_FORCE_CLOSE(vhostfd[i]); =20 if (!(nicstr =3D qemuBuildNicDevStr(vm->def, net, vlan, 0, - queueSize, priv->qemuCaps, mtu))) + queueSize, priv->qemuCaps))) goto try_remove; =20 qemuDomainObjEnterMonitor(driver, vm); diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index d8a678b..cebb490 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -503,8 +503,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def, virQEMUDriverPtr driver, virDomainNetDefPtr net, int *tapfd, - size_t *tapfdSize, - unsigned int *mtu) + size_t *tapfdSize) { const char *brname; int ret =3D -1; @@ -545,7 +544,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def, def->uuid, tunpath, tapfd, *tap= fdSize, virDomainNetGetActualVirtPortPr= ofile(net), virDomainNetGetActualVlan(net), - net->coalesce, net->mtu, mtu, + net->coalesce, 0, NULL, tap_create_flags) < 0) { virDomainAuditNetDevice(def, net, tunpath, false); goto cleanup; diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h index ba74ac2..a7faa0b 100644 --- a/src/qemu/qemu_interface.h +++ b/src/qemu/qemu_interface.h @@ -51,8 +51,7 @@ int qemuInterfaceBridgeConnect(virDomainDefPtr def, virQEMUDriverPtr driver, virDomainNetDefPtr net, int *tapfd, - size_t *tapfdSize, - unsigned int *mtu) + size_t *tapfdSize) ATTRIBUTE_NONNULL(2); =20 int qemuInterfaceOpenVhostNet(virDomainDefPtr def, --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list