From nobody Sun May 5 13:15:58 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547761083032631.0786719169882; Thu, 17 Jan 2019 13:38:03 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A131BB655; Thu, 17 Jan 2019 21:38:00 +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 24C1D19741; Thu, 17 Jan 2019 21:38:00 +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 7526D1803391; Thu, 17 Jan 2019 21:37:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0HLbvUd006318 for ; Thu, 17 Jan 2019 16:37:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 81D4F608E8; Thu, 17 Jan 2019 21:37:57 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-55.phx2.redhat.com [10.3.117.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3723A6063E for ; Thu, 17 Jan 2019 21:37:54 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Thu, 17 Jan 2019 16:37:50 -0500 Message-Id: <20190117213750.32655-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: fix i6300esb watchdog hotplug on Q35 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 17 Jan 2019 21:38:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When commit 361c8dc17 added support for hotplugging the i6300esb watchdog device (first in libvirt-3.9.0), it accidentally contstructed the commandline for the device_add command before allocating a PCI address for the device. With no PCI address specified in the command, the watchdog would simply be placed at the lowest unused PCI slot. On a 440fx guest, this doesn't cause a problem, because libvirt's PCI address allocation algorithm would most likely give the same address anyway (usually a slot on pci-root), so nobody noticed the omission of address from the command. But on a Q35 guest, the lowest unused PCI slot is on pcie-root, which doesn't support hotplug; libvirt knows enough to assign a PCI address that is on a pcie-to-pci-bridge (because its slots *do* support hotplug), but qemu doesn't, so if there is no PCI address in the command, qemu just tries to plug the new device into pcie-root, and fails because it doesn't support hotplug, e.g.: error: Failed to attach device from watchdog.xml error: internal error: unable to execute QEMU command 'device_add': Bus 'pcie.0' does not support hotplugging The solution is simply to build the command string after assigning a PCI address, not before. Resolves: https://bugzilla.redhat.com/1666559 Signed-off-by: Laine Stump Reviewed-by: John Ferlan --- src/qemu/qemu_hotplug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a1c3ca999b..40c693483e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3280,9 +3280,6 @@ qemuDomainAttachWatchdog(virQEMUDriverPtr driver, if (qemuAssignDeviceWatchdogAlias(watchdog) < 0) return -1; =20 - if (!(watchdogstr =3D qemuBuildWatchdogDevStr(vm->def, watchdog, priv-= >qemuCaps))) - return -1; - if (watchdog->model =3D=3D VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB) { if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0) goto cleanup; @@ -3294,6 +3291,9 @@ qemuDomainAttachWatchdog(virQEMUDriverPtr driver, goto cleanup; } =20 + if (!(watchdogstr =3D qemuBuildWatchdogDevStr(vm->def, watchdog, priv-= >qemuCaps))) + goto cleanup; + /* QEMU doesn't have a 'dump' action; we tell qemu to 'pause', then libvirt listens for the watchdog event, and we perform the dump ourselves. so convert 'dump' to 'pause' for the qemu cli */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list