From nobody Wed Oct 30 22:11:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1722520412153282.0222944778676; Thu, 1 Aug 2024 06:53:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1A08E13E1; Thu, 1 Aug 2024 09:53:31 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 12A101306; Thu, 1 Aug 2024 09:53:08 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8ADAB11F8; Thu, 1 Aug 2024 09:53:05 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1133811E2 for ; Thu, 1 Aug 2024 09:53:05 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-61--Ak_bgHAP4CuVYFj31fdYg-1; Thu, 01 Aug 2024 09:53:03 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BC66319560B0 for ; Thu, 1 Aug 2024 13:53:02 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.16]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E01811955D42 for ; Thu, 1 Aug 2024 13:53:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722520384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eBPaxsoDMoSE8vwku2WuykxsJFFIF51/RUjGiMOXkp8=; b=gCUN7jN4kmc3g3E3RuZr/gVKljwub2tkWk5bJmNXe1+Ngir4eKiuxxz9o7R1y+NJ0ctzh4 D9Cbyd6dVasEMBNe/N7tH4Al00+vN7vj+4cGchtg+yExRI8nV0cPQIhXEnIneZ1alTM7aT yCzHDqPdGV82eZqujBBF17v3EDCDVnw= X-MC-Unique: -Ak_bgHAP4CuVYFj31fdYg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 1/2] qemu_domain: Strip from s390(x) definitions Date: Thu, 1 Aug 2024 15:52:57 +0200 Message-ID: <6e3edd6453f3cb6e6cce9abc5615739b3462f28c.1722520223.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZV7MRVE347S5RF55LA3DMSTXX4JB4BZE X-Message-ID-Hash: ZV7MRVE347S5RF55LA3DMSTXX4JB4BZE X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1722520412723116600 Content-Type: text/plain; charset="utf-8" The s390(x) machines never supported ACPI. That didn't stop users enabling ACPI in their config. As of libvirt-9.2 (98c4e3d073) with new enough qemu we reject configs which require ACPI, but qemu can't satisfy it. This breaks migration of existing VMs with the old wrong configs to new libvirt installations. To address this introduce a post-parse fixup removing the ACPI flag specifically for s390 machines which do enable it in the definition. The advantage of doing it in post-parse, rather than simply relaxing the ABI stability check to allow users providing an fixed XML when migrating (allowing change of the ACPI flag for s390 in ABI stability check, as it doesn't impact ABI), is that only the destination installation needs to be patched in order to preserve migration. To mitigate the disadvantage of simply stripping it from all s390(x) configs the hack is not applied when defining or starting a new domain from the XML, to preserve the error about unsupported configuration. Resolves: https://issues.redhat.com/browse/RHEL-49516 Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_domain.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 198ab99aef..a7a34e66e2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5020,6 +5020,51 @@ qemuDomainDefPostParseBasic(virDomainDef *def, } +/** + * qemuDomainDefACPIPostParse: + * @def: domain definition + * @qemuCaps: qemu capabilities object + * + * Fixup the use of ACPI flag on certain architectures that never supporte= d it + * and users for some reason used it, which would break migration to newer + * libvirt versions which check whether given machine type supports ACPI. + * + * The fixup is done in post-parse as it's hard to update the ABI stability + * check on source of the migration. + */ +static void +qemuDomainDefACPIPostParse(virDomainDef *def, + virQEMUCaps *qemuCaps, + unsigned int parseFlags) +{ + /* Only cases when ACPI is enabled need to be fixed up */ + if (def->features[VIR_DOMAIN_FEATURE_ACPI] !=3D VIR_TRISTATE_SWITCH_ON) + return; + + /* This fixup is applicable _only_ on architectures which were present= as of + * libvirt-9.2 and *never* supported ACPI. The fixup is currently done= only + * for existing users of s390(x) to fix migration for configs which had + * despite being ignored. + */ + if (def->os.arch !=3D VIR_ARCH_S390 && + def->os.arch !=3D VIR_ARCH_S390X) + return; + + /* Strip the feature only for non-fresh configs, in order to s= till + * produce an error if the feature is present in a newly defined one. + * + * The use of the VIR_DOMAIN_DEF_PARSE_ABI_UPDATE looks counter-intuit= ive, + * but it's used only in qemuDomainCreateXML/qemuDomainDefineXMLFlags = APIs + * */ + if (parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) + return; + + /* To be sure, we only strip ACPI if given machine type doesn't suppor= t it */ + if (virQEMUCapsMachineSupportsACPI(qemuCaps, def->virtType, def->os.ma= chine) =3D=3D VIR_TRISTATE_BOOL_NO) + def->features[VIR_DOMAIN_FEATURE_ACPI] =3D VIR_TRISTATE_SWITCH_ABS= ENT; +} + + static int qemuDomainDefPostParse(virDomainDef *def, unsigned int parseFlags, @@ -5040,6 +5085,8 @@ qemuDomainDefPostParse(virDomainDef *def, if (qemuDomainDefMachinePostParse(def, qemuCaps) < 0) return -1; + qemuDomainDefACPIPostParse(def, qemuCaps, parseFlags); + if (qemuDomainDefBootPostParse(def, driver, parseFlags) < 0) return -1; --=20 2.45.2 From nobody Wed Oct 30 22:11:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1722520486017218.80699123857983; Thu, 1 Aug 2024 06:54:46 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9F8E712CC; Thu, 1 Aug 2024 09:54:44 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 37541147B; Thu, 1 Aug 2024 09:53:16 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A1C2211E2; Thu, 1 Aug 2024 09:53:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 98FAA11CC for ; Thu, 1 Aug 2024 09:53:06 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-w_HKjRaeNhuYZswF6vzeNA-1; Thu, 01 Aug 2024 09:53:05 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 356871955F43 for ; Thu, 1 Aug 2024 13:53:04 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.16]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 40C1C1955D4C for ; Thu, 1 Aug 2024 13:53:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722520386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BGGZFIPjVSj4L38mzSvkDWU31Ik7M+brWQawP48BL6I=; b=FOA7y+W7v6TjD1KJHVH5b3sIntt1Hd6+KK1drPMRyJL/SJgUYvRNKS091g8FHo1hETxZQW 3YnXX/Xe+eJpqiEhM0C5AovNlUqvYJxVZI6DKdiENitRSKam7/4XyavhWjQewpTYwczH1S SlCaVCWpfsF7IGlIk+Lro0HeNQQpiX0= X-MC-Unique: w_HKjRaeNhuYZswF6vzeNA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH v2 2/2] qemuxmlconftest: Add tests for the ACPI stripping hack on s390 Date: Thu, 1 Aug 2024 15:52:58 +0200 Message-ID: <5b47299391e00083bcc12fdeca53eeafbbddcf34.1722520223.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PEQMYJP4ZN7QXJAPRHM5HUQI4GJNDOBG X-Message-ID-Hash: PEQMYJP4ZN7QXJAPRHM5HUQI4GJNDOBG X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1722520489300116600 Content-Type: text/plain; charset="utf-8" Replace the 'misc-acpi' case by testing a bunch of architectures for how ACPI is handled including a test for the s390 ACPI strip hack added in previous commit. The input files are adapted from the corresponding '-minimal.xml' files. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: Boris Fiuczynski --- .../aarch64-noacpi-acpi.aarch64-latest.err | 1 + tests/qemuxmlconfdata/aarch64-noacpi-acpi.xml | 18 ++++++++ .../misc-acpi.x86_64-latest.args | 34 --------------- .../misc-acpi.x86_64-latest.xml | 41 ------------------- tests/qemuxmlconfdata/misc-acpi.xml | 33 --------------- .../riscv64-virt-acpi.riscv64-latest.args | 33 +++++++++++++++ .../riscv64-virt-acpi.riscv64-latest.xml | 36 ++++++++++++++++ tests/qemuxmlconfdata/riscv64-virt-acpi.xml | 15 +++++++ ...s390x-ccw-acpi.s390x-latest.abi-update.err | 1 + .../s390x-ccw-acpi.s390x-latest.args | 32 +++++++++++++++ .../s390x-ccw-acpi.s390x-latest.xml | 27 ++++++++++++ tests/qemuxmlconfdata/s390x-ccw-acpi.xml | 15 +++++++ tests/qemuxmlconftest.c | 18 +++++++- 13 files changed, 195 insertions(+), 109 deletions(-) create mode 100644 tests/qemuxmlconfdata/aarch64-noacpi-acpi.aarch64-lates= t.err create mode 100644 tests/qemuxmlconfdata/aarch64-noacpi-acpi.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args delete mode 100644 tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml delete mode 100644 tests/qemuxmlconfdata/misc-acpi.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.= args create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.riscv64-latest.= xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-acpi.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.abi-u= pdate.err create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.args create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.s390x-latest.xml create mode 100644 tests/qemuxmlconfdata/s390x-ccw-acpi.xml diff --git a/tests/qemuxmlconfdata/aarch64-noacpi-acpi.aarch64-latest.err b= /tests/qemuxmlconfdata/aarch64-noacpi-acpi.aarch64-latest.err new file mode 100644 index 0000000000..5f379d56ce --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-noacpi-acpi.aarch64-latest.err @@ -0,0 +1 @@ +unsupported configuration: machine type 'borzoi' does not support ACPI diff --git a/tests/qemuxmlconfdata/aarch64-noacpi-acpi.xml b/tests/qemuxmlc= onfdata/aarch64-noacpi-acpi.xml new file mode 100644 index 0000000000..10dbeabd6d --- /dev/null +++ b/tests/qemuxmlconfdata/aarch64-noacpi-acpi.xml @@ -0,0 +1,18 @@ + + aarch64test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + + hvm + + + + + + + /usr/bin/qemu-system-aarch64 + + + diff --git a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args b/tests/qem= uxmlconfdata/misc-acpi.x86_64-latest.args deleted file mode 100644 index c4e09c0af2..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.args +++ /dev/null @@ -1,34 +0,0 @@ -LC_ALL=3DC \ -PATH=3D/bin \ -HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ -USER=3Dtest \ -LOGNAME=3Dtest \ -XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ -/usr/bin/qemu-system-x86_64 \ --name guest=3DQEMUGuest1,debug-threads=3Don \ --S \ --object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ --machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Don \ --accel tcg \ --cpu qemu64 \ --m size=3D219136k \ --object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ --overcommit mem-lock=3Doff \ --smp 1,sockets=3D1,cores=3D1,threads=3D1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ --mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ --rtc base=3Dutc \ --no-shutdown \ --boot strict=3Don \ --device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","read-only":false}' \ --device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-stor= age","id":"ide0-0-0","bootindex":1}' \ --audiodev '{"id":"audio1","driver":"none"}' \ --sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ --msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml b/tests/qemu= xmlconfdata/misc-acpi.x86_64-latest.xml deleted file mode 100644 index 176926bb60..0000000000 --- a/tests/qemuxmlconfdata/misc-acpi.x86_64-latest.xml +++ /dev/null @@ -1,41 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - - hvm - - - - - - - qemu64 - - - destroy - restart - destroy - - /usr/bin/qemu-system-x86_64 - - - - -
- - -
- - -
- - - - -