From nobody Sun May 12 21:49:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551740446551883.6187806895861; Mon, 4 Mar 2019 15:00:46 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id DC1F73DE03; Mon, 4 Mar 2019 23:00:42 +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 E18EF61491; Mon, 4 Mar 2019 23:00:41 +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 5A935181A010; Mon, 4 Mar 2019 23:00:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x24N0aix025973 for ; Mon, 4 Mar 2019 18:00:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id AECB11001DCF; Mon, 4 Mar 2019 23:00:36 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A84821001DCE for ; Mon, 4 Mar 2019 23:00:33 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D21C9307D8F4 for ; Mon, 4 Mar 2019 23:00:23 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Mon, 04 Mar 2019 16:00:13 -0700 From: Jim Fehlig To: libvir-list@redhat.com Date: Mon, 4 Mar 2019 16:00:01 -0700 Message-Id: <20190304230001.18690-1-jfehlig@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 04 Mar 2019 23:00:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 04 Mar 2019 23:00:24 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] libxl: Add support for max_grant_frame setting 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 04 Mar 2019 23:00:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Xen 4.10 introduced the max_grant_frames xl config setting, which can be set globally in xl.conf(5) or per-domain in xl.cfg(5). max_grant_frames specifies the maximum number of grant frames the domain is allowed to have, which in turn controls the number of pages the domain can share. This patch adds support for setting max_grant_frames on a global level in libxl.conf. Per-domain support via domXML can be provided in a future patch. Signed-off-by: Jim Fehlig Reviewed-by: Daniel P. Berrang=C3=A9 --- src/libxl/libvirtd_libxl.aug | 2 ++ src/libxl/libxl.conf | 8 ++++++++ src/libxl/libxl_conf.c | 9 +++++++++ src/libxl/libxl_conf.h | 2 ++ src/libxl/test_libvirtd_libxl.aug.in | 1 + 5 files changed, 22 insertions(+) diff --git a/src/libxl/libvirtd_libxl.aug b/src/libxl/libvirtd_libxl.aug index 58b9af3707..1c3e2719fc 100644 --- a/src/libxl/libvirtd_libxl.aug +++ b/src/libxl/libvirtd_libxl.aug @@ -29,6 +29,7 @@ module Libvirtd_libxl =3D let keepalive_interval_entry =3D int_entry "keepalive_interval" let keepalive_count_entry =3D int_entry "keepalive_count" let nested_hvm_entry =3D bool_entry "nested_hvm" + let max_grant_frames_entry =3D int_entry "max_grant_frames" =20 (* Each entry in the config is one of the following ... *) let entry =3D autoballoon_entry @@ -36,6 +37,7 @@ module Libvirtd_libxl =3D | keepalive_interval_entry | keepalive_count_entry | nested_hvm_entry + | max_grant_frames_entry =20 let comment =3D [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \= t\n][^\n]*)?/ . del /\n/ "\n" ] let empty =3D [ label "#empty" . eol ] diff --git a/src/libxl/libxl.conf b/src/libxl/libxl.conf index 72825a71c5..12d7abeda6 100644 --- a/src/libxl/libxl.conf +++ b/src/libxl/libxl.conf @@ -49,3 +49,11 @@ # element. # By default it is disabled. #nested_hvm =3D 0 + +# Xen domains can grant other domains access to its memory pages, which is +# most commonly used for the operation of paravirtualized devices. +# max_grant_frames was introduced in Xen 4.10 and can be used to specify a +# default value for the maximum number of grant frames each domain started +# by libvirt is allowed to have. The default value is 32. +# +#max_grant_frames =3D 32 diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index c769050ff1..f57ffe1a01 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -393,6 +393,12 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, def->mem.cur_balloon =3D VIR_ROUND_UP(def->mem.cur_balloon, 1024); b_info->max_memkb =3D virDomainDefGetMemoryInitial(def); b_info->target_memkb =3D def->mem.cur_balloon; + +#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS + if (cfg->max_grant_frames > 0) + b_info->max_grant_frames =3D cfg->max_grant_frames; +#endif + if (hvm || pvh) { if (caps && def->cpu && def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROU= GH)) { @@ -1888,6 +1894,9 @@ int libxlDriverConfigLoadFile(libxlDriverConfigPtr cf= g, if (virConfGetValueBool(conf, "nested_hvm", &cfg->nested_hvm) < 0) goto cleanup; =20 + if (virConfGetValueUInt(conf, "max_grant_frames", &cfg->max_grant_fram= es) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index fee94241af..985524f3eb 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -86,6 +86,8 @@ struct _libxlDriverConfig { =20 bool nested_hvm; =20 + unsigned int max_grant_frames; + /* Once created, caps are immutable */ virCapsPtr caps; =20 diff --git a/src/libxl/test_libvirtd_libxl.aug.in b/src/libxl/test_libvirtd= _libxl.aug.in index 372a43f94a..754ddc10f6 100644 --- a/src/libxl/test_libvirtd_libxl.aug.in +++ b/src/libxl/test_libvirtd_libxl.aug.in @@ -7,3 +7,4 @@ module Test_libvirtd_libxl =3D { "keepalive_interval" =3D "5" } { "keepalive_count" =3D "5" } { "nested_hvm" =3D "0" } +{ "max_grant_frames" =3D "32" } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list