From nobody Sun Feb 8 12:43:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1624443181; cv=none; d=zohomail.com; s=zohoarc; b=eJ32o5fIHSXv8xRABwOrdBR2B+Uccq3L6unUR+vTSeJxJ2uKonoCUNvai9nYMQ2mFhvWemgwdwdDlfMoUUkYrISkezT0eplt6lbGToOlZUbI+tY1JVojgN3blb36bEkuXBHbSK/E8qdlACUN1EWCFnZjangi2I9nHqy5eCURHsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624443181; 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=GXwaqAgz1iLC9h7XDnzxdblHieGE2i08THx7k96Ohww=; b=GjOYauobE++eCeEEt6CSzWHpBvyJ82MBGbEKYaRWcKFs3DbtgqR4Rw6I1MfOFyo2rZ4NWP2uV9iikDF8eIFcN4WQT88SDxRfryJPRZ1YPoOo0Al3STigjgXHkSCzPjo5Dp6TuS/BiGDGLexOKMryULGNnJvCPG8splz8QFQVTt0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1624443181611845.1875211363716; Wed, 23 Jun 2021 03:13:01 -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-506-ounoTJMwP-GGFVso1ZxYUw-1; Wed, 23 Jun 2021 06:12:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23857824F97; Wed, 23 Jun 2021 10:12:53 +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 00BEF60C05; Wed, 23 Jun 2021 10:12:53 +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 BF0261801258; Wed, 23 Jun 2021 10:12:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15NACoUZ020949 for ; Wed, 23 Jun 2021 06:12:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id CE6E519D7C; Wed, 23 Jun 2021 10:12:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD72A19C66; Wed, 23 Jun 2021 10:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624443180; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GXwaqAgz1iLC9h7XDnzxdblHieGE2i08THx7k96Ohww=; b=i+raopGdXAydAcMyIjRXA2SwAuWjz4lR8Mzu88ioooxnXSiaugEb2w1dutc+0sqniOaIOY uQfP+Hg4uUM5YL0aOtFi8ltNjQwYjhPWLjKCOUP4Q/8vfTHs38umZU2lf5Yvl8YE0MIskF yJEunDZ3yqk75ygceGSvpIbtlTKUbXU= X-MC-Unique: ounoTJMwP-GGFVso1ZxYUw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v4 06/14] Introduce property to virtio-mem Date: Wed, 23 Jun 2021 12:12:11 +0200 Message-Id: <1d90ee24da536a5145cc2fe3bac63d3d352f8875.1624442835.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: david@redhat.com 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.12 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The virtio-mem has another property that isn't exposed yet: actual size exposed to the guest. Please note, that this is different to because esp. on sizing the memory down guest may refuse to release some blocks. Therefore, let's have another size to report in the XML. But because of its nature, the won't be parsed and is report only (for live XMLs). Signed-off-by: Michal Privoznik --- docs/formatdomain.rst | 7 +++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 9 +++++++-- src/conf/domain_conf.h | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 967d5bbb91..01e5a3fe03 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -7773,6 +7773,7 @@ Example: usage of the memory devices 0 2048 1048576 + 524288 @@ -7888,6 +7889,12 @@ Example: usage of the memory devices The total size exposed to the guest. Must respect ``block`` granulari= ty and be smaller than or equal to ``size``. =20 + ``actual`` + Active XML for ``virtio-mem`` model may contain ``actual`` element th= at + reflects the actual size of the corresponding virtio memory device. T= he + element is formatted into live XML and never parsed, i.e. it is + output-only element. + :anchor:`` =20 IOMMU devices diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 439dd893ff..b832dce19b 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6649,6 +6649,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 76344b592d..1ef70e8a80 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25870,7 +25870,8 @@ virDomainMemorySourceDefFormat(virBuffer *buf, =20 static void virDomainMemoryTargetDefFormat(virBuffer *buf, - virDomainMemoryDef *def) + virDomainMemoryDef *def, + unsigned int flags) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 @@ -25892,6 +25893,10 @@ virDomainMemoryTargetDefFormat(virBuffer *buf, =20 virBufferAsprintf(&childBuf, "%llu\n", def->requestedsize); + if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) { + virBufferAsprintf(&childBuf, "%llu\n", + def->actualsize); + } } =20 virXMLFormatElement(buf, "target", NULL, &childBuf); @@ -25924,7 +25929,7 @@ virDomainMemoryDefFormat(virBuffer *buf, if (virDomainMemorySourceDefFormat(buf, def) < 0) return -1; =20 - virDomainMemoryTargetDefFormat(buf, def); + virDomainMemoryTargetDefFormat(buf, def, flags); =20 virDomainDeviceInfoFormat(buf, &def->info, flags); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0c43a6ae64..b57eba655d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2482,6 +2482,9 @@ struct _virDomainMemoryDef { unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */ unsigned long long blocksize; /* kibibytes; valid only for VIRTIO_MEM = */ unsigned long long requestedsize; /* kibibytes; valid only for VIRTIO_= MEM */ + unsigned long long actualsize; /* kibibytes, valid for VIRTIO_MEM and + active domain only, only to report n= ever + parse */ bool readonly; /* valid only for NVDIMM */ =20 /* required for QEMU NVDIMM ppc64 support */ --=20 2.31.1