From nobody Fri Apr 26 21:09:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1605729562; cv=none; d=zohomail.com; s=zohoarc; b=mfPWsOD9pgJRtsJkf71/US56RA97e/i6dvZWxcNAgUoiEiHAmQdb86j+Ng8eJou1clIfn7fKBeYIR1UAazFZZoE+C77RKDpSItm9pSwBIg/ZZuU0qbZNYyZ9VJuaazXZkov5wnfto9ZpQe9xtOLAHBhHM2clzWNZzXBTgoEmqxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605729562; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2x/tu72gFLj9STNH49zWeM0tM+h1INTaCisu0BnitX0=; b=YN694u+RPpf1mPmr4D48GD9Xd/46lznJ1gGvw6K09b0OfkK1GLqV6ejQEfRMsyc9xTGUG0RUNSkZ7jurbexrhrNdt03SVTZFFOi/lPUTwLVRTxkxCn0ZindrK/to6b8d9hyRLxv1zHHh/jzHb9+2Sf5TZ5dvHBYxOOlpXCkIu6M= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1605729562321311.52826497325077; Wed, 18 Nov 2020 11:59:22 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-PavzvBYvMES_QXGg6VGPPg-1; Wed, 18 Nov 2020 14:59:18 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61BEB800479; Wed, 18 Nov 2020 19:59:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37A3919651; Wed, 18 Nov 2020 19:59:13 +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 030E38C7A0; Wed, 18 Nov 2020 19:59:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AIJwxlq021608 for ; Wed, 18 Nov 2020 14:58:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 478DA112D40C; Wed, 18 Nov 2020 19:58:59 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43C3C112D19E for ; Wed, 18 Nov 2020 19:58:59 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2823E8007DF for ; Wed, 18 Nov 2020 19:58:59 +0000 (UTC) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-7SnVk8yQNmOxK-kiAhTJJA-1; Wed, 18 Nov 2020 14:58:57 -0500 Received: by mail-qk1-f176.google.com with SMTP id q5so3045689qkc.12 for ; Wed, 18 Nov 2020 11:58:57 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:d88a:482:7c39:5cca:96f6]) by smtp.gmail.com with ESMTPSA id n21sm7022757qke.21.2020.11.18.11.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 11:58:55 -0800 (PST) X-MC-Unique: PavzvBYvMES_QXGg6VGPPg-1 X-MC-Unique: 7SnVk8yQNmOxK-kiAhTJJA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2x/tu72gFLj9STNH49zWeM0tM+h1INTaCisu0BnitX0=; b=X4d4JdGJGQkzTJhy+s9cT1gVLMGP41YbvsrmygFLGP3yC6Ii4hjfs9rT18yUWY/5XN WRdUUrq8pUEYB8sj0XnyGe/SILME8mDA5lwXVNPdKV/V0cEufkkc7XnH10bdhJX+rC4B ohKkDtJgSMlP0totRbVv3dZKKwSCAt/6IF6iKyk4yvB0j0yRW4hXDOAAJ9IB5YKFG/Wx ODcaW1plQ8m/SQ9lLm3RjJpGZ+PcI0PGu3kFn09UtG7INEnmFsvX82a9jhR2WRCzlYkF E6QxjkFHUw7kwvP/SwXatN44wsgj6mX9WKKgzrGIJ3OERz/0vPtP+4Vy3ketu3vQam8l glcg== X-Gm-Message-State: AOAM531XOJSPZr7RAO1GuYpsjycn7PxJIK5TcZfHTcP9+qH9cNW+3gmu yRlKzao0p0MSc1zlsq81fSUqdRp3W9ze5g== X-Google-Smtp-Source: ABdhPJzNBNI2yhjMpuDJHECtXUsKOExi/Ufy2htRm30sXxJIwP+yrQbCY8XTlK/qhF+lWViH0XcNnw== X-Received: by 2002:a05:620a:1389:: with SMTP id k9mr6504944qki.46.1605729536277; Wed, 18 Nov 2020 11:58:56 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 5/6] qemu_domain.c: post parse pSeries NVDIMM align with PARSE_ABI_UPDATE Date: Wed, 18 Nov 2020 16:58:33 -0300 Message-Id: <20201118195834.1187381-6-danielhb413@gmail.com> In-Reply-To: <20201118195834.1187381-1-danielhb413@gmail.com> References: <20201118195834.1187381-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A previous patch removed the pSeries NVDIMM align that wasn't being done properly. This patch reintroduces it in the right fashion, making it reliant on VIR_DOMAIN_DEF_PARSE_ABI_UPDATE. This makes it complying with the intended design defined by commit c7d7ba85a624. Since the PARSE_ABI_FLAG is more restrictive than checking for !migrate && !snapshot, like is being currently done with qemuDomainAlignMemorySizes(), this means that we'll align the pSeries NVDIMMs in two places - in post parse time for new guests, and in qemuDomainAlignMemorySizes() for all guests that aren't migrating or in a snapshot. Another difference is that the logic is now in the QEMU driver instead of domain_conf.c. This was necessary because all considerations made about the PARSE_ABI_UPDATE flag were done under QEMU. Given that no other driver supports ppc64 there is no impact in this change. A new test was added to exercise what we're doing. It consists of a a copy of the existing 'memory-hotplug-nvdimm-ppc64' xml2xml test, called with the PARSE_ABI_UPDATE flag. As intended, we're not changing QEMU command line or any XML without the flag, while the pseries NVDIMM memory is being aligned when the flag is used. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 33 +++++++++++- ...memory-hotplug-nvdimm-ppc64-abi-update.xml | 50 +++++++++++++++++++ ...memory-hotplug-nvdimm-ppc64-abi-update.xml | 50 +++++++++++++++++++ tests/qemuxml2xmltest.c | 7 +++ 4 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-= update.xml create mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-ab= i-update.xml diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2158080a56..b9eb54a11c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5337,6 +5337,33 @@ qemuDomainTPMDefPostParse(virDomainTPMDefPtr tpm, } =20 =20 +static int +qemuDomainMemoryDefPostParse(virDomainMemoryDefPtr mem, virArch arch, + unsigned int parseFlags) +{ + /* Memory alignment can't be done for migration or snapshot + * scenarios. This logic was defined by commit c7d7ba85a624. + * + * There is no easy way to replicate at this point the same conditions + * used to call qemuDomainAlignMemorySizes(), which means checking if + * we're not migrating and not in a snapshot. + * + * We can use the PARSE_ABI_UPDATE flag, which is more strict - + * existing guests will not activate the flag to avoid breaking + * boot ABI. This means that any alignment done here will be replicated + * later on by qemuDomainAlignMemorySizes() to contemplate existing + * guests as well. */ + if (parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) { + if (ARCH_IS_PPC64(arch) && + mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && + virDomainNVDimmAlignSizePseries(mem) < 0) + return -1; + } + + return 0; +} + + static int qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, const virDomainDef *def, @@ -5394,6 +5421,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, ret =3D qemuDomainTPMDefPostParse(dev->data.tpm, def->os.arch); break; =20 + case VIR_DOMAIN_DEVICE_MEMORY: + ret =3D qemuDomainMemoryDefPostParse(dev->data.memory, def->os.arc= h, + parseFlags); + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_INPUT: @@ -5406,7 +5438,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, case VIR_DOMAIN_DEVICE_MEMBALLOON: case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_RNG: - case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: ret =3D 0; diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.= xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.xml new file mode 100644 index 0000000000..ae5a17d3c8 --- /dev/null +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.xml @@ -0,0 +1,50 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1267710 + 1267710 + 2 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + +
+ + + + 49545eb3-75e1-2d0a-acdd-f0294406c99e + + /tmp/nvdimm + + + 550000 + 0 + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-updat= e.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml new file mode 100644 index 0000000000..24b0982a7b --- /dev/null +++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64-abi-update.xml @@ -0,0 +1,50 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1572992 + 1267710 + 2 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + +
+ + + + 49545eb3-75e1-2d0a-acdd-f0294406c99e + + /tmp/nvdimm + + + 524416 + 0 + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 603ba71686..595a897a70 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1240,6 +1240,13 @@ mymain(void) QEMU_CAPS_DEVICE_NVDIMM_UNAR= MED); DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST= _BRIDGE, QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST_FULL("memory-hotplug-nvdimm-ppc64-abi-update", WHEN_BOTH, + ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, + ARG_QEMU_CAPS, + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, + QEMU_CAPS_DEVICE_NVDIMM, + QEMU_CAPS_LAST); + DO_TEST("net-udp", NONE); =20 DO_TEST("video-virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU); --=20 2.26.2