From nobody Sun May 5 11:19:47 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571465900; cv=none; d=zoho.com; s=zohoarc; b=hHDr6OE3RoQrq/z5JcIMadJvOTHPebBozqgDHz+7VyIh0hfPa78wDGJ5FVLW0BMrCWbn0mdmlIgaf4kEFEn2C78S8H8inRl1M1loMyo20CXv9TD47ydTep6LZMcQS5LH53rtQIPW7q9GlxV5DlKL9YuKlyp/cOTTOGlulD6WuLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571465900; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/sXj5D2rolPa13azSa3OmsegvV34S7f1QuEYIcN6Aeg=; b=T6Rasscrmi8RDURQmUFMhdwh9jxwUOVbFeVcR+uqbxlkgWAqDr4yAfXR7HmfEyGpW1XC1FhOihrboczAdj8W34/RdETLpkE44hgpTbm8ByPMDDmoY7EASEFieeDw3iEBP14QqQmIXWH/pb1UNhfGzXwbjLBoP3zq0PHcKFElilw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571465900333965.2110169829567; Fri, 18 Oct 2019 23:18:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 552CBC0A1978; Sat, 19 Oct 2019 06:18:17 +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 634FF5C207; Sat, 19 Oct 2019 06:18:16 +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 188D518005A0; Sat, 19 Oct 2019 06:18:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9J6I9hi012611 for ; Sat, 19 Oct 2019 02:18:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9AB87600D1; Sat, 19 Oct 2019 06:18:09 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-114.phx2.redhat.com [10.3.117.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56137600C8 for ; Sat, 19 Oct 2019 06:18:06 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Sat, 19 Oct 2019 02:18:02 -0400 Message-Id: <20191019061802.25811-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: avoid double reservation of PCI address when hotplugging interface type='hostdev' 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 19 Oct 2019 06:18:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 01ca4010d86 (libvirt v5.1.0) moved address reservation for hotplugged interface devices up to an earlier point in qemuDomainAttachNetDevice() because some function called when hotplugging on aarch64 needed to know the address type, and failed when it was "none". This unfortunately caused a regression, because it also made PCI address reservation happen before we noticed that the device was a *hostdev* interface. Those interfaces are hotplugged by just calling out to qemuDomainAttachHostdevDevice() - that function would then also attempt to reserve the *same PCI address* that had just been reserved in qemuDomainAttachNetDevice(). The solution is to move the bit of code that short-circuits out to virDomainHostdevAttach() up *even earlier* so that no PCI address has been allocated by the time it's called. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1744523 Signed-off-by: Laine Stump --- src/qemu/qemu_hotplug.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 55696ebe9a..80ddee6587 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1181,6 +1181,17 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0) goto cleanup; =20 + if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) { + /* This is really a "smart hostdev", so it should be attached + * as a hostdev (the hostdev code will reach over into the + * netdev-specific code as appropriate), then also added to + * the nets list (see cleanup:) if successful. + */ + ret =3D qemuDomainAttachHostDevice(driver, vm, + virDomainNetGetActualHostdev(net)= ); + goto cleanup; + } + if (qemuDomainIsS390CCW(vm->def) && net->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CCW)) { @@ -1260,17 +1271,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto cleanup; break; =20 - case VIR_DOMAIN_NET_TYPE_HOSTDEV: - /* This is really a "smart hostdev", so it should be attached - * as a hostdev (the hostdev code will reach over into the - * netdev-specific code as appropriate), then also added to - * the nets list (see cleanup:) if successful. - */ - ret =3D qemuDomainAttachHostDevice(driver, vm, - virDomainNetGetActualHostdev(net)= ); - goto cleanup; - break; - case VIR_DOMAIN_NET_TYPE_VHOSTUSER: queueSize =3D net->driver.virtio.queues; if (!queueSize) @@ -1313,6 +1313,10 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, } break; =20 + case VIR_DOMAIN_NET_TYPE_HOSTDEV: + /* this switch is skipped by hostdev interfaces */ + break; + case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list