From nobody Fri Apr 26 12:32:53 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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=1602545797; cv=none; d=zohomail.com; s=zohoarc; b=nHfgwCTLJyUGDNnidzfjateHbrde8XnMNJIk7FAHTbzQuD3vjBhHq9m982Yg+bsx/Oet8akq1MS7L1rA+vwpu/89hPSdPYsJi9X3sXI8hb3Y7D5xx+BiqJ8f37CRA8u8RMqFPytPMJUeHxL3JUUTTgHAdHrGQQgV82DTXHImfsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602545797; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dfvaXyXmh/faf+uU1rWkA4uMxKaoq0aB+X7fD1AHkQ8=; b=UCmxDw03WhzIU1X1MPITxcjmj5iPF6C/mmF9UEBHuoIJym05wmP8x1mJVv2U3+UyNM3tasBon8wetRb6GdYDJvXSrzkGRERyuNXR1xmtaWNf44wn8cQpWGvjaCnRL8WsSJykXCoQfmaJ5osWG/QeTUHMe9M9D3d6PpDlVPlwmDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1602545797927109.42689625295304; Mon, 12 Oct 2020 16:36:37 -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-100-YiJHNMWDM5aS057guBENXQ-1; Mon, 12 Oct 2020 19:36:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B680D8030AD; Mon, 12 Oct 2020 23:36:28 +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 103E6100164C; Mon, 12 Oct 2020 23:36:27 +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 C532B181A06C; Mon, 12 Oct 2020 23:36:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09CNaMKJ008381 for ; Mon, 12 Oct 2020 19:36:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id B2E0F5DA33; Mon, 12 Oct 2020 23:36:22 +0000 (UTC) Received: from npache.remote.csb (ovpn-116-246.rdu2.redhat.com [10.10.116.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DCDE5D9CD; Mon, 12 Oct 2020 23:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602545796; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dfvaXyXmh/faf+uU1rWkA4uMxKaoq0aB+X7fD1AHkQ8=; b=bUFr8bTYFSyUtMf5KNQ/iV4zBxMk6UVqJg0eKzB9htAaba3HhDRiTiNJjz9TiCK6/PPWQh esJ6GVuDTP4wT8WVzo+mW936aW7+frAbObDwjSbmS2/eQNUjzlR4Ll9URbvUVbymH9kj+A eP9VtQ1UprWl3UWueVPVPPQSYT5Kykw= X-MC-Unique: YiJHNMWDM5aS057guBENXQ-1 From: Nico Pache To: libvir-list@redhat.com, david@redhat.com, nitesh@redhat.com Subject: [PATCH v2 1/4] Document and parser support for the Virtio free page reporting feature. Date: Mon, 12 Oct 2020 19:35:36 -0400 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: npache@redhat.com, ehabkost@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.84 on 10.5.11.22 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This will add the proper documentation and parser support for the free page reporting feature that is introduced in QEMU 5.1. Signed-off-by: Nico Pache Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 6 ++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 21 +++++++++++++++++++++ src/conf/domain_conf.h | 1 + 4 files changed, 33 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index df5ac28028..e75b360b32 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -6755,6 +6755,12 @@ Example: manually added device with static PCI slot = 2 requested release some memory at the last moment before a guest's process get kil= led by Out of Memory killer. :since:`Since 1.3.1, QEMU and KVM only` =20 +``free-page-reporting`` + The optional ``free-page-reporting`` attribute allows to enable/disable + ("on"/"off", respectively) the ability of the QEMU virtio memory balloo= n to + return unused pages back to the hypervisor to be used by other guests or + processes. :since:`Since 5.1, QEMU and KVM only` + ``period`` The optional ``period`` allows the QEMU virtio memory balloon driver to provide statistics through the ``virsh dommemstat [domain]`` diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7d4b105981..0a0f0ed8a8 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4539,6 +4539,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 51efeb0e42..883f7081c6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15336,6 +15336,7 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionPt= r xmlopt, VIR_XPATH_NODE_AUTORESTORE(ctxt) unsigned int period =3D 0; g_autofree char *model =3D NULL; + g_autofree char *freepage_reporting =3D NULL; g_autofree char *deflate =3D NULL; =20 def =3D g_new0(virDomainMemballoonDef, 1); @@ -15360,6 +15361,13 @@ virDomainMemballoonDefParseXML(virDomainXMLOptionP= tr xmlopt, goto error; } =20 + if ((freepage_reporting =3D virXMLPropString(node, "free-page-reporting= ")) && + (def->free_page_reporting =3D virTristateSwitchTypeFromString(freep= age_reporting)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid free-page-reporting attribute value '%s'= "), freepage_reporting); + goto error; + } + ctxt->node =3D node; if (virXPathUInt("string(./stats/@period)", ctxt, &period) < -1) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -23538,6 +23546,15 @@ virDomainMemballoonDefCheckABIStability(virDomainM= emballoonDefPtr src, return false; } =20 + if (src->free_page_reporting !=3D dst->free_page_reporting) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target balloon free-page-reporting attribute va= lue " + "'%s' does not match source '%s'"), + virTristateSwitchTypeToString(dst->free_page_repor= ting), + virTristateSwitchTypeToString(src->free_page_repor= ting)); + return false; + } + if (src->virtio && dst->virtio && !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; @@ -27644,6 +27661,10 @@ virDomainMemballoonDefFormat(virBufferPtr buf, virBufferAsprintf(&attrBuf, " autodeflate=3D'%s'", virTristateSwitchTypeToString(def->autodeflate)); =20 + if (def->free_page_reporting !=3D VIR_TRISTATE_SWITCH_ABSENT) + virBufferAsprintf(&attrBuf, " free-page-reporting=3D'%s'", + virTristateSwitchTypeToString(def->free_page_reporting)); + if (def->period) virBufferAsprintf(&childrenBuf, "\n", def->p= eriod); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 450686dfb5..902dd58112 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1790,6 +1790,7 @@ struct _virDomainMemballoonDef { virDomainDeviceInfo info; int period; /* seconds between collections */ int autodeflate; /* enum virTristateSwitch */ + int free_page_reporting; /* enum virTristateSwitch */ virDomainVirtioOptionsPtr virtio; }; =20 --=20 2.18.4 From nobody Fri Apr 26 12:32:53 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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=1602545797; cv=none; d=zohomail.com; s=zohoarc; b=BMbPlt9XQV47BKn3c71TW8Vtx2Bp6o5+tuqSNhAjwsUed/sNFf8c4Gjams2UEIIjIvYcoOLsswGiwZWXc0pUyeVGbPEkJjdwgfi0C2ylwHmR/CVQ4T9/KHwHu7GEH6kl02wuYF6nGNZRh3mNaqmXU3h1CZlovE0jR8gL92jSzm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602545797; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=sTxEPHbVLywHa1xN5otGZ4XR0Vrp7dC2XJSJBNvbtAc=; b=XVwCWQ7dfeP9LddwJojA+ewuuR/6DYa29B7DZHn7mrJA6Tdds7jlA6aGnVI1LVYYDSv/3l2uV7u+2Ae2FJHA1KXFn1s7z3YXyFamjV2CITCGgVZfQGRN7390WacJuf/v7JPfr0ICjgwmwVpF6KkkwV7E/BfTPCzuQwPS89bEb9A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1602545797835112.32062357792609; Mon, 12 Oct 2020 16:36:37 -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-200-YH_9_3LdMUGZBye_6AusaQ-1; Mon, 12 Oct 2020 19:36:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C92157058; Mon, 12 Oct 2020 23:36:29 +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 0A7107666C; Mon, 12 Oct 2020 23:36:29 +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 5B69E181A06E; Mon, 12 Oct 2020 23:36:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09CNaNxx008392 for ; Mon, 12 Oct 2020 19:36:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E2FF5D98A; Mon, 12 Oct 2020 23:36:23 +0000 (UTC) Received: from npache.remote.csb (ovpn-116-246.rdu2.redhat.com [10.10.116.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBD895D9CD; Mon, 12 Oct 2020 23:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602545796; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sTxEPHbVLywHa1xN5otGZ4XR0Vrp7dC2XJSJBNvbtAc=; b=Oxw3Oz607zSnDYDRN+4EXNXRdZdz5Y9GJf2hOR8VTmihNoJuGuKh5/jvVVpTE9toe4Ebpr EqoSunXO1CD5PYdOhy+A/xYuMWfCklnNaHcEOgXDtSJ4mHvJpENYERUTme8qPAxKt8aPFj s7fUBJD4k9zX0IHzTHVZqRk4U9I5xic= X-MC-Unique: YH_9_3LdMUGZBye_6AusaQ-1 From: Nico Pache To: libvir-list@redhat.com, david@redhat.com, nitesh@redhat.com Subject: [PATCH v2 2/4] QEMU: declare qemu capabilities for the Virtio Free page reporting feature Date: Mon, 12 Oct 2020 19:35:37 -0400 Message-Id: <1612bbf1ac789a21c97c218108d831f0122e3060.1602545532.git.npache@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: npache@redhat.com, ehabkost@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.11 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch will introduce the free-page-reporting feature capabilities that are in qemu 5.1 Signed-off-by: Nico Pache Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 + 4 files changed, 5 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 02136fd3b3..81d9ecd886 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -600,6 +600,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 380 */ "usb-host.hostdevice", + "virtio-balloon.free-page-reporting", ); =20 =20 @@ -1341,6 +1342,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVirtioBalloon[] { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, NULL }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL }, { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, + { "free-page-reporting", QEMU_CAPS_VIRTIO_BALLOON_FREE_PAGE_REPORTING,= NULL }, }; =20 =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 107056ba17..44c45589f0 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -580,6 +580,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 380 */ QEMU_CAPS_USB_HOST_HOSTDEVICE, /* -device usb-host.hostdevice */ + QEMU_CAPS_VIRTIO_BALLOON_FREE_PAGE_REPORTING, /*virtio balloon free-pa= ge-reporting */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.1.0.x86_64.xml index 987beb965e..9ebd7ea582 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -243,6 +243,7 @@ + 5001000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.2.0.x86_64.xml index 3ee678ef8f..52b6a47004 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -243,6 +243,7 @@ + 5001050 0 43100243 --=20 2.18.4 From nobody Fri Apr 26 12:32:53 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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=1602545811; cv=none; d=zohomail.com; s=zohoarc; b=kmjrIweTNNOWt6ZO/Mi5zjoSzdW7IanMfgKetispGDMMLUNrQ/TW9HkmnaLYL0RI1BRWEkTuQvWsrSDo6XePEzeQ2180Y0U4Kl2IIn+nCFVehRuZ0866j6l0UCnIINlpR+D6M8Q6ZaCY4S8VJkd+tEyhvWOM33ckGREsMO42C3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602545811; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=cSBYSZIJGkD/u+GEjLwAjT6zrwUPagZiXyILewBV3cc=; b=BRznuC0XLldHBeYStAO+2B/hh6uFNS4KP4HLLGWqRLnNxMfCQdXEJ+x6rArHPdllQWCJ6ZxNN6zXCHkJsjKM83EN9Qs+XUzenVs1u7fCstvfbluxd4yje4hyJZpZWkYwQo52oRpc3YWExWeb69yZzpHOJgXg0dPqW53a91XV3R0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1602545811729943.4104633662791; Mon, 12 Oct 2020 16:36:51 -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-164-z2_Wr5V_O8SkiniGPGh3Zw-1; Mon, 12 Oct 2020 19:36:48 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39341835B48; Mon, 12 Oct 2020 23:36:43 +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 1688010013C0; Mon, 12 Oct 2020 23:36:43 +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 CDE7C58112; Mon, 12 Oct 2020 23:36:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09CNaOK4008403 for ; Mon, 12 Oct 2020 19:36:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4771D5D98A; Mon, 12 Oct 2020 23:36:24 +0000 (UTC) Received: from npache.remote.csb (ovpn-116-246.rdu2.redhat.com [10.10.116.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id A57095D9CD; Mon, 12 Oct 2020 23:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602545810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cSBYSZIJGkD/u+GEjLwAjT6zrwUPagZiXyILewBV3cc=; b=dlEM01g/0fVl2vrQSbCj4fORtTODgYsnPQI96hA4FStpytbGKKnHOEmk7TqP7FcFg62EAA rnSL4x6USneiuzOjDEO6d3yI2AO2DjfkJgP/wWv0jbvgh7oIoeLUr2vXNckYADxX5w39ei afKuiA86aXgRKg+Ybm9+JEY4JyxHOTE= X-MC-Unique: z2_Wr5V_O8SkiniGPGh3Zw-1 From: Nico Pache To: libvir-list@redhat.com, david@redhat.com, nitesh@redhat.com Subject: [PATCH v2 3/4] QEMU: introduce Virtio free page reporting feature Date: Mon, 12 Oct 2020 19:35:38 -0400 Message-Id: <04c2c513b2322a7d3418ba6c597775677b619a17.1602545532.git.npache@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: npache@redhat.com, ehabkost@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.84 on 10.5.11.22 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch enables the free-page-reporting in qemu. Signed-off-by: Nico Pache Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 5 +++++ src/qemu/qemu_validate.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9519861e92..6466efc756 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3830,6 +3830,11 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virTristateSwitchTypeToString(def->memballoon->a= utodeflate)); } =20 + if (def->memballoon->free_page_reporting !=3D VIR_TRISTATE_SWITCH_ABSE= NT) { + virBufferAsprintf(&buf, ",free-page-reporting=3D%s", + virTristateSwitchTypeToString(def->memballoon->free_page= _reporting)); + } + qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio); =20 if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a212605579..cfeb1e67c4 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3926,6 +3926,13 @@ qemuValidateDomainDeviceDefMemballoon(const virDomai= nMemballoonDef *memballoon, return -1; } =20 + if (memballoon->free_page_reporting !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_FREE_PAGE_REPO= RTING)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("free-page-reporting is not supported by this QE= MU binary")); + return -1; + } + if (qemuValidateDomainVirtioOptions(memballoon->virtio, qemuCaps) < 0) return -1; =20 --=20 2.18.4 From nobody Fri Apr 26 12:32:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1602545811; cv=none; d=zohomail.com; s=zohoarc; b=CM8fhDnDGspXk+WxBW1Qw0AoQ/E5iYNXKA4pvDFurr6mOyELYpb2LkYmg9GjrMnNqbkhCRbG1knj95XM7z8AxBcR0XxSSH+8ks48PIs4vk6EEiMrgED04rBH5cVryaQXnmlpCq+ZZjfCKXMH9jky/9qxJfr05PCQN2mokah6+7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602545811; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=1kwcOA6fsrUxfBI5RJ2mSfwxSKj9RKdwm5mGkUnF22A=; b=gj2PnBwPNl1o6DwDDrBANQzuluKzl4Roh4RTgYtd/dAOpckoXIeaxttvRIuqpiyX1hpLcr6SZxUVAwhtREnHTfGGmA4sVz+/W5iqzCb78m9QTx6BYxI0SvvJiVYwJb6yFDdkC0GgkjF6KZcR/72ZEITSwqL84IORutEX6fVuomQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 160254581159553.69295476544016; Mon, 12 Oct 2020 16:36:51 -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-591-8qOe3Z0zPBytelIAazdTLg-1; Mon, 12 Oct 2020 19:36:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30142185A0C9; Mon, 12 Oct 2020 23:36:43 +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 102557666D; Mon, 12 Oct 2020 23:36:43 +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 C743F58111; Mon, 12 Oct 2020 23:36:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09CNaSKG008438 for ; Mon, 12 Oct 2020 19:36:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id F357C5D98A; Mon, 12 Oct 2020 23:36:27 +0000 (UTC) Received: from npache.remote.csb (ovpn-116-246.rdu2.redhat.com [10.10.116.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E22D5D9CD; Mon, 12 Oct 2020 23:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602545810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1kwcOA6fsrUxfBI5RJ2mSfwxSKj9RKdwm5mGkUnF22A=; b=Y0dM6uDmiZDZF5AWAcWSxGJVr+tB1AsdWLCAaV7zljq+anxagj2TihpQrvJnQB/cZA0Uiv eHrfX2H8bWA/4zfVJaW+Y0DyRGNGsCOtU+QzgGBv8hYxyHhrYSCgbSF2nAlB5Rjwna3cd1 gdMsqrxBXe1OJ/wJ+1+c/WuZhOIW4pA= X-MC-Unique: 8qOe3Z0zPBytelIAazdTLg-1 From: Nico Pache To: libvir-list@redhat.com, david@redhat.com, nitesh@redhat.com Subject: [PATCH v2 4/4] provide testing for free-page-reporting feature in QEMU Date: Mon, 12 Oct 2020 19:35:39 -0400 Message-Id: <13134605a65c79838ebc1f3729ca5ddb5cd462f3.1602545532.git.npache@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: npache@redhat.com, ehabkost@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.11 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This provides basic testing for the free-page-reporting feature that is introduced in qemu 5.1. Signed-off-by: Nico Pache Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- ...-options-memballoon-freepage-reporting.err | 1 + ...loon-freepage-reporting.x86_64-latest.args | 36 +++++++++++++++++++ ...-options-memballoon-freepage-reporting.xml | 22 ++++++++++++ tests/qemuxml2argvtest.c | 2 ++ ...-options-memballoon-freepage-reporting.xml | 22 ++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-freepa= ge-reporting.err create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-freepa= ge-reporting.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-freepa= ge-reporting.xml create mode 100644 tests/qemuxml2xmloutdata/virtio-options-memballoon-free= page-reporting.xml diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-repo= rting.err b/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-repor= ting.err new file mode 100644 index 0000000000..de06de0a85 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-reporting.e= rr @@ -0,0 +1 @@ +unsupported configuration: free-page-reporting is not supported by this QE= MU binary diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-repo= rting.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-options-memballoon= -freepage-reporting.x86_64-latest.args new file mode 100644 index 0000000000..6ebc45d931 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-reporting.x= 86_64-latest.args @@ -0,0 +1,36 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dp= c.ram \ +-cpu qemu64 \ +-m 214 \ +-object memory-backend-ram,id=3Dpc.ram,size=3D224395264 \ +-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,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2,\ +free-page-reporting=3Don \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-repo= rting.xml b/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-repor= ting.xml new file mode 100644 index 0000000000..ff7549a789 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-freepage-reporting.x= ml @@ -0,0 +1,22 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 49567326d4..8aa791d9f7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3195,6 +3195,7 @@ mymain(void) DO_TEST_CAPS_LATEST("virtio-options-fs-packed"); DO_TEST_CAPS_LATEST("virtio-options-input-packed"); DO_TEST_CAPS_LATEST("virtio-options-memballoon-packed"); + DO_TEST_CAPS_LATEST("virtio-options-memballoon-freepage-reporting"); DO_TEST_CAPS_LATEST("virtio-options-net-packed"); DO_TEST_CAPS_LATEST("virtio-options-rng-packed"); DO_TEST_CAPS_LATEST("virtio-options-video-packed"); @@ -3232,6 +3233,7 @@ mymain(void) DO_TEST_PARSE_ERROR("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MO= USE, QEMU_CAPS_VIRTIO_KEYBOARD); DO_TEST_PARSE_ERROR("virtio-options-memballoon-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-freepage-reporting", NO= NE); DO_TEST_PARSE_ERROR("virtio-options-net-packed", NONE); DO_TEST_PARSE_ERROR("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRT= IO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); diff --git a/tests/qemuxml2xmloutdata/virtio-options-memballoon-freepage-re= porting.xml b/tests/qemuxml2xmloutdata/virtio-options-memballoon-freepage-r= eporting.xml new file mode 100644 index 0000000000..ff7549a789 --- /dev/null +++ b/tests/qemuxml2xmloutdata/virtio-options-memballoon-freepage-reporting= .xml @@ -0,0 +1,22 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + --=20 2.18.4