From nobody Wed May 1 23:22:05 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 1492082842978898.6444098073324; Thu, 13 Apr 2017 04:27:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B2B37E9EE; Thu, 13 Apr 2017 11:27:21 +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 2DB1E7A42D; Thu, 13 Apr 2017 11:27:21 +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 D159318523D1; Thu, 13 Apr 2017 11:27:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3DBR7qw026670 for ; Thu, 13 Apr 2017 07:27:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C2207A419; Thu, 13 Apr 2017 11:27:07 +0000 (UTC) Received: from antique-work.brq.redhat.com (dhcp129-230.brq.redhat.com [10.34.129.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id D547217112 for ; Thu, 13 Apr 2017 11:27:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7B2B37E9EE Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.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 7B2B37E9EE From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 13 Apr 2017 13:27:02 +0200 Message-Id: <1cf1ddf91c49c6764deb6c6d357b2df9b5990285.1492082683.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 1/2] conf: add a new parse flag VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 13 Apr 2017 11:27:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" So far there is probably no change that is allowed to be done by the VIR_DOMAIN_DEF_PARSE_ABI_UPDATE flag that would break guest ABI but this may change in the future. This introduces new VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION which should be used only for ABI updates that are "safe" for persistent migration. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 4 ++++ src/qemu/qemu_migration_cookie.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d660c06e0f..206b561589 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3818,7 +3818,8 @@ virDomainDefPostParseMemory(virDomainDefPtr def, /* Attempt to infer the initial memory size from the sum NUMA memory s= izes * in case ABI updates are allowed or the element wasn't spec= ified */ if (def->mem.total_memory =3D=3D 0 || - parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) + parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE || + parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION) numaMemory =3D virDomainNumaGetMemorySize(def->numa); =20 /* calculate the sizes of hotplug memory */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 26c0e6b887..7da554f8ee 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2726,6 +2726,10 @@ typedef enum { VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE =3D 1 << 10, /* skip parsing of security labels */ VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL =3D 1 << 11, + /* Allows updates in post parse callback for incoming persistent migra= tion + * that would break ABI otherwise. This should be used only if it's s= afe + * to do such change. */ + VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION =3D 1 << 12, } virDomainDefParseFlags; =20 typedef enum { diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index bd12f11246..12887892db 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -1173,7 +1173,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mi= g, mig->persistent =3D virDomainDefParseNode(doc, nodes[0], caps, driver->xmlopt, NULL, VIR_DOMAIN_DEF_PARSE_INACT= IVE | - VIR_DOMAIN_DEF_PARSE_ABI_U= PDATE | + VIR_DOMAIN_DEF_PARSE_ABI_U= PDATE_MIGRATION | VIR_DOMAIN_DEF_PARSE_SKIP_= VALIDATE); if (!mig->persistent) { /* virDomainDefParseNode already reported --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 23:22:05 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 1492082833731568.624322208612; Thu, 13 Apr 2017 04:27:13 -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 555F3C04B95D; Thu, 13 Apr 2017 11:27:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 299D29FDE1; Thu, 13 Apr 2017 11:27:11 +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 9B5E75EC68; Thu, 13 Apr 2017 11:27:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3DBR8KJ026679 for ; Thu, 13 Apr 2017 07:27:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 28BE87A42C; Thu, 13 Apr 2017 11:27:08 +0000 (UTC) Received: from antique-work.brq.redhat.com (dhcp129-230.brq.redhat.com [10.34.129.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id A67A617112 for ; Thu, 13 Apr 2017 11:27:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 555F3C04B95D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 555F3C04B95D From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 13 Apr 2017 13:27:03 +0200 Message-Id: <7177dacb2ae2394cea4adcf6d3af34e1385a084b.1492082684.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 2/2] qemu_domain: use correct default USB controller on ppc64 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 13 Apr 2017 11:27:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The history of USB controller for ppc64 guest is complex and goes back to libvirt 1.3.1 where the fun started. Prior Libvirt 1.3.1 if no model for USB controller was specified we've simply passed "-usb" on QEMU command line. Since Libvirt 1.3.1 there is a patch (8156493d8db) that fixes this issue by using "-device pci-ohci,..." but it breaks migration with older Libvirts which was agreed that's acceptable. However this patch didn't reflect this change in the domain XML and the model was still missing. Since Libvirt 2.2.0 there is a patch (f55eaccb0c5) that fixes the issue with not setting the USB model into domain XML which we need to know about to not break the migration and since the default model was *pci-ohci* it was used as default in this patch as well. This patch tries to take all the previous changes into account and also change the default for newly defined domains that don't specify any model for USB controller. The VIR_DOMAIN_DEF_PARSE_ABI_UPDATE is set only if new domain is defined or new device is added into a domain which means that in all other cases we will use the old *pci-ohci* model instead of the better and not broken *nec-usb-xhci* model. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1373184 Signed-off-by: Pavel Hrdina --- src/qemu/qemu_domain.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 39bc8c7483..1aff774012 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3141,7 +3141,8 @@ qemuDomainShmemDefPostParse(virDomainShmemDefPtr shm) static int qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, const virDomainDef *def, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps, + unsigned int parseFlags) { switch ((virDomainControllerType)cont->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: @@ -3169,9 +3170,16 @@ qemuDomainControllerDefPostParse(virDomainController= DefPtr cont, * address is found */ cont->model =3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE; } else if (ARCH_IS_PPC64(def->os.arch)) { - /* Default USB controller for ppc64 is pci-ohci */ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) + /* To not break migration we need to set default USB contr= oller + * for ppc64 to pci-ohci if we cannot change ABI of the VM. + * The nec-usb-xhci controller is used as default only for + * newly defined domains or devices. */ + if ((parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) { + cont->model =3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XH= CI; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI)) { cont->model =3D VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OH= CI; + } } else { /* Default USB controller for anything else is piix3-uhci = */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) @@ -3370,7 +3378,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, =20 if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER && qemuDomainControllerDefPostParse(dev->data.controller, def, - qemuCaps) < 0) + qemuCaps, parseFlags) < 0) goto cleanup; =20 if (dev->type =3D=3D VIR_DOMAIN_DEVICE_SHMEM && --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list