From nobody Sat Feb 7 12:11:26 2026 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=1600137844; cv=none; d=zohomail.com; s=zohoarc; b=mqVrjuiQ2/Pai7+QOEzpK1wryyPmpF4TIm5pXriQ+tj28AJlgMSOavWulUTrhPSWPWtrRAL4FQhnW/VgAE9VkETNThPVVf3p/hpBjoOFC18iIPjlYotmB/JGo0PnnVPdW6kCR/dqtGirfIScsbtghLLEZHhyqV/iiF41arSCtbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600137844; 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=sXsUstS17VIwyTAf2E2VrNXb6hRW0zL4tU4lHbsMa0o=; b=bEu/vHKRoLQnufw6qB3x+BI/PpwcO9G8DVfH8HdUaUdI2VQqOnpBEpzn7ABkriwP/udTa0mFBxcnTWAT0uyvWD5aPV6EtrVi/C1VKtAq3g8fczwh6M9lIhBTRxhKvVLknVj9BQ4ls8f2ICFC1cuRjG+8dZoRYFvJNtDnv1pCGWI= 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 1600137844240472.8845217458544; Mon, 14 Sep 2020 19:44:04 -0700 (PDT) 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-98-L_BdgnwkPni16UguqmSenw-1; Mon, 14 Sep 2020 22:43:40 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64E69801A9D; Tue, 15 Sep 2020 02:43:35 +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 4457D5FC16; Tue, 15 Sep 2020 02:43:35 +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 010F01833000; Tue, 15 Sep 2020 02:43:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08F2hLoQ019573 for ; Mon, 14 Sep 2020 22:43:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 00C812157F23; Tue, 15 Sep 2020 02:43:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFFB02166B28 for ; Tue, 15 Sep 2020 02:43:17 +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 90D8118A070D for ; Tue, 15 Sep 2020 02:43:17 +0000 (UTC) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-140-5h9-nKXIORqWQ1snY1AsZw-1; Mon, 14 Sep 2020 22:43:15 -0400 Received: by mail-qv1-f41.google.com with SMTP id j10so1046016qvk.11 for ; Mon, 14 Sep 2020 19:43:15 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7c7:5342:27d9:20da:5ada:61cf]) by smtp.gmail.com with ESMTPSA id v16sm14897324qkg.37.2020.09.14.19.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 19:43:14 -0700 (PDT) X-MC-Unique: L_BdgnwkPni16UguqmSenw-1 X-MC-Unique: 5h9-nKXIORqWQ1snY1AsZw-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=sXsUstS17VIwyTAf2E2VrNXb6hRW0zL4tU4lHbsMa0o=; b=LPjlj8ZlSmeg+EM5trH8m4Q4CKsNj+Fkfz8Xw/75m3vW9XAlbsDriwsUBzOG5pqKEL +cAKXgOl7A+YxlcHBLWvOsiGjcHZbRXy3EqpNEy1kYJSbinfB6pAJKi3P4ZmbGCICvI7 dGPeZ4VfDBZ6klZFIjBCXCpU6+BJFC/F8voz9orTA+1uQU47Qan4SMIBy+n7Jfm3666j tc6FqSV4wSOggN7DCqdw5UxM8ofhP0K7TPJhYBtP+uBmmrx7yzVE9kBgfcOQNG5T/d6c H19nBTm7dcINlo1Qg5GVtsA9nd+QEhfvwX3bEfENchkx1jawkwFJC2IH768sz1Dk6Tnl eYFA== X-Gm-Message-State: AOAM531JY7mT3i4afwYrY82b1f7m75RFaCI49j0nuILaCuzp45wdgcdX fkFqx6E8x8VXuq97iSNrPPYYxfx91sE= X-Google-Smtp-Source: ABdhPJxKIwijoDrBM1OJVznfLCfYt6pwEnmhMFopJ0VNaQ4BwgOWjiPvmB6PgG4chdmek19BleblGg== X-Received: by 2002:a0c:b41d:: with SMTP id u29mr15997708qve.28.1600137794578; Mon, 14 Sep 2020 19:43:14 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 3/4] domain_conf.c: auto-align pSeries NVDIMM in virDomainMemoryDefParseXML() Date: Mon, 14 Sep 2020 23:42:58 -0300 Message-Id: <20200915024259.193494-4-danielhb413@gmail.com> In-Reply-To: <20200915024259.193494-1-danielhb413@gmail.com> References: <20200915024259.193494-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.6 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.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The alignment for the pSeries NVDIMM does not depend on runtime constraints. This means that it can be done in device parse time, instead of runtime, allowing the domain XML to reflect what the auto-alignment would do when the domain starts. This brings consistency between the NVDIMM size reported by the domain XML and what the guest sees, without impacting existing guests that are using an unaligned size - they'll work as usual, but the domain XML will be updated with the actual size of the NVDIMM. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 35 +++++++++++-------- .../memory-hotplug-nvdimm-ppc64.xml | 2 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 63434b9d3e..0fd16964c1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16965,6 +16965,25 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr x= mlopt, } VIR_FREE(tmp); =20 + /* source */ + if ((node =3D virXPathNode("./source", ctxt)) && + virDomainMemorySourceDefParseXML(node, ctxt, def) < 0) + goto error; + + /* target */ + if (!(node =3D virXPathNode("./target", ctxt))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing element for device")); + goto error; + } + + if (virDomainMemoryTargetDefParseXML(node, ctxt, def) < 0) + goto error; + + /* The UUID calculation for pSeries NVDIMM can be done earlier, + * but we'll also need to handle the size alignment, which depends + * on virDomainMemoryTargetDefParseXML() already done. Let's do it + * all here. */ if (def->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && ARCH_IS_PPC64(dom->os.arch)) { /* Extract nvdimm uuid or generate a new one */ @@ -16981,23 +17000,11 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr = xmlopt, "%s", _("malformed uuid element")); goto error; } - } - - /* source */ - if ((node =3D virXPathNode("./source", ctxt)) && - virDomainMemorySourceDefParseXML(node, ctxt, def) < 0) - goto error; =20 - /* target */ - if (!(node =3D virXPathNode("./target", ctxt))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing element for device")); - goto error; + if (virDomainNVDimmAlignSizePseries(def) < 0) + goto error; } =20 - if (virDomainMemoryTargetDefParseXML(node, ctxt, def) < 0) - goto error; - if (virDomainDeviceInfoParseXML(xmlopt, memdevNode, &def->info, flags) < 0) goto error; diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml b/tes= ts/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml index ae5a17d3c8..ecb1b83b4a 100644 --- a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml +++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml @@ -38,7 +38,7 @@ /tmp/nvdimm - 550000 + 524416 0