From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
sstabellini@kernel.org, wei.liu2@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, tim@xen.org, julien.grall@arm.com,
jbeulich@suse.com, dgdegra@tycho.nsa.gov
Subject: [PATCH v8 14/15] xen: make grant table limits boot parameters dom0 only
Date: Wed, 20 Sep 2017 08:34:29 +0200 [thread overview]
Message-ID: <20170920063430.9105-15-jgross@suse.com> (raw)
In-Reply-To: <20170920063430.9105-1-jgross@suse.com>
The boot parameters gnttab_max_frames and gnttab_max_maptrack_frames
are used for dom0 only now, as all other domains require a
XEN_DOMCTL_set_gnttab_limits call now. So make that explicit by
setting the boot values for dom0 only.
While updating the documentation regarding new scope of the boot
parameters remove the documentation of gnttab_max_nr_frames as it
isn't existing any longer.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V7:
- add boot parameter documentation changes
---
docs/misc/xen-command-line.markdown | 15 +++------------
xen/arch/arm/domain_build.c | 2 +-
xen/common/grant_table.c | 35 ++++++++++++++---------------------
xen/include/xen/grant_table.h | 4 +---
4 files changed, 19 insertions(+), 37 deletions(-)
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 9797c8db2d..7bdc4119a1 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -877,26 +877,17 @@ Specify which console gdbstub should use. See **console**.
> Default: `32`
-Specify the maximum number of frames which any domain may use as part
+Specify the maximum number of frames which dom0 may use as part
of its grant table.
### gnttab\_max\_maptrack\_frames
> `= <integer>`
-> Default: `8 * gnttab_max_frames`
+> Default: `1024`
-Specify the maximum number of frames to use as part of a domains
+Specify the maximum number of frames to use as part of dom0's
maptrack array.
-### gnttab\_max\_nr\_frames
-> `= <integer>`
-
-*Deprecated*
-Use **gnttab\_max\_frames** and **gnttab\_max\_maptrack\_frames** instead.
-
-Specify the maximum number of frames per grant table operation and the
-maximum number of maptrack frames domain.
-
### guest\_loglvl
> `= <level>[/<rate-limited level>]` where level is `none | error | warning | info | debug | all`
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c34238ec1b..295a539780 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2098,7 +2098,7 @@ static void __init find_gnttab_region(struct domain *d,
kinfo->gnttab_size = (_etext - _stext) & PAGE_MASK;
/* Make sure the grant table will fit in the region */
- if ( (kinfo->gnttab_size >> PAGE_SHIFT) < max_grant_frames )
+ if ( grant_table_verify_size(d, kinfo->gnttab_size >> PAGE_SHIFT) )
panic("Cannot find a space for the grant table region\n");
#ifdef CONFIG_ARM_32
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index a0d8f32869..65084d7f5a 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -84,21 +84,8 @@ struct grant_table {
#define DEFAULT_MAX_NR_GRANT_FRAMES 32
#endif
-unsigned int __read_mostly max_grant_frames;
-integer_param("gnttab_max_frames", max_grant_frames);
-
-/* The maximum number of grant mappings is defined as a multiplier of the
- * maximum number of grant table entries. This defines the multiplier used.
- * Pretty arbitrary. [POLICY]
- * As gnttab_max_nr_frames has been deprecated, this multiplier is deprecated too.
- * New options allow to set max_maptrack_frames and
- * map_grant_table_frames independently.
- */
#define DEFAULT_MAX_MAPTRACK_FRAMES 1024
-static unsigned int __read_mostly max_maptrack_frames;
-integer_param("gnttab_max_maptrack_frames", max_maptrack_frames);
-
/*
* Note that the three values below are effectively part of the ABI, even if
* we don't need to make them a formal part of it: A guest suspended for
@@ -3462,6 +3449,10 @@ grant_table_create(
struct domain *d)
{
struct grant_table *t;
+ static unsigned int max_grant_frames;
+ static unsigned int max_maptrack_frames;
+ integer_param("gnttab_max_frames", max_grant_frames);
+ integer_param("gnttab_max_maptrack_frames", max_maptrack_frames);
if ( (t = xzalloc(struct grant_table)) == NULL )
return -ENOMEM;
@@ -3469,14 +3460,17 @@ grant_table_create(
/* Simple stuff. */
percpu_rwlock_resource_init(&t->lock, grant_rwlock);
spin_lock_init(&t->maptrack_lock);
- t->max_grant_frames = max_grant_frames;
- t->max_maptrack_frames = max_maptrack_frames;
/* Okay, install the structure. */
d->grant_table = t;
if ( d->domain_id == 0 )
+ {
+ t->max_grant_frames = max_grant_frames ? : DEFAULT_MAX_NR_GRANT_FRAMES;
+ t->max_maptrack_frames =
+ max_maptrack_frames ? : DEFAULT_MAX_MAPTRACK_FRAMES;
return grant_table_init(t);
+ }
return 0;
}
@@ -3855,18 +3849,17 @@ static int __init gnttab_usage_init(void)
{
BUILD_BUG_ON(DEFAULT_MAX_MAPTRACK_FRAMES < DEFAULT_MAX_NR_GRANT_FRAMES);
- if ( !max_grant_frames )
- max_grant_frames = DEFAULT_MAX_NR_GRANT_FRAMES;
-
- if ( !max_maptrack_frames )
- max_maptrack_frames = DEFAULT_MAX_MAPTRACK_FRAMES;
-
register_keyhandler('g', gnttab_usage_print_all,
"print grant table usage", 1);
return 0;
}
__initcall(gnttab_usage_init);
+bool __init grant_table_verify_size(struct domain *d, unsigned int frames)
+{
+ return d->grant_table->max_grant_frames > frames;
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index d2bd2416c4..04a4d82e71 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -31,9 +31,6 @@
struct grant_table;
-/* The maximum size of a grant table. */
-extern unsigned int max_grant_frames;
-
/* Create/destroy per-domain grant table context. */
int grant_table_create(
struct domain *d);
@@ -42,6 +39,7 @@ void grant_table_destroy(
void grant_table_init_vcpu(struct vcpu *v);
int grant_table_set_limits(struct domain *d, unsigned int grant_frames,
unsigned int maptrack_frames);
+bool grant_table_verify_size(struct domain *d, unsigned int frames);
/*
* Check if domain has active grants and log first 10 of them.
--
2.12.3
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-20 6:34 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 6:34 [PATCH v8 00/15] xen: better grant v2 support Juergen Gross
2017-09-20 6:34 ` [PATCH v8 01/15] xen: move XENMAPSPACE_grant_table code into grant_table.c Juergen Gross
2017-09-20 12:40 ` Julien Grall
2017-09-20 6:34 ` [PATCH v8 02/15] xen: clean up grant_table.h Juergen Gross
2017-09-20 6:34 ` [PATCH v8 03/15] xen: add new domctl hypercall to set grant table resource limits Juergen Gross
2017-09-20 8:26 ` Paul Durrant
2017-09-20 8:49 ` Jan Beulich
2017-09-20 6:34 ` [PATCH v8 04/15] xen: add function for obtaining highest possible memory address Juergen Gross
2017-09-20 8:57 ` Jan Beulich
[not found] ` <59C2499A020000780017D412@suse.com>
2017-09-20 8:58 ` Juergen Gross
2017-09-20 9:32 ` Jan Beulich
[not found] ` <59C251C8020000780017D4D7@suse.com>
2017-09-20 9:39 ` Juergen Gross
2017-09-20 12:51 ` Julien Grall
2017-09-20 13:08 ` Juergen Gross
2017-09-20 14:24 ` Julien Grall
2017-09-20 14:33 ` Juergen Gross
2017-09-20 17:15 ` Julien Grall
2017-09-21 4:18 ` Juergen Gross
2017-09-20 6:34 ` [PATCH v8 05/15] xen: add max possible mfn to struct xen_sysctl_physinfo Juergen Gross
2017-09-20 8:58 ` Jan Beulich
[not found] ` <59C249F3020000780017D415@suse.com>
2017-09-20 9:00 ` Juergen Gross
2017-09-20 12:53 ` Julien Grall
2017-09-20 13:06 ` Juergen Gross
2017-09-20 6:34 ` [PATCH v8 06/15] libxc: add libxc support for setting grant table resource limits Juergen Gross
2017-09-20 6:34 ` [PATCH v8 07/15] tools: set grant limits for xenstore stubdom Juergen Gross
2017-09-20 6:34 ` [PATCH v8 08/15] libxl: add max possible mfn to libxl_physinfo Juergen Gross
2017-09-20 6:34 ` [PATCH v8 09/15] xl: add global grant limit config items Juergen Gross
2017-09-20 6:34 ` [PATCH v8 10/15] libxl: add libxl support for setting grant table resource limits Juergen Gross
2017-09-20 6:34 ` [PATCH v8 11/15] xen: delay allocation of grant table sub structures Juergen Gross
2017-09-20 9:22 ` Jan Beulich
[not found] ` <59C24F80020000780017D473@suse.com>
2017-09-20 9:44 ` Juergen Gross
2017-09-20 10:02 ` Jan Beulich
[not found] ` <59C258D4020000780017D521@suse.com>
2017-09-20 10:05 ` Juergen Gross
2017-09-20 6:34 ` [PATCH v8 12/15] xen/arm: move arch specific grant table bits into grant_table.c Juergen Gross
2017-09-20 9:25 ` Jan Beulich
2017-09-20 14:34 ` Julien Grall
2017-09-21 4:36 ` Juergen Gross
2017-09-20 6:34 ` [PATCH v8 13/15] xen: make grant resource limits per domain Juergen Gross
2017-09-20 10:34 ` Jan Beulich
2017-09-20 14:37 ` Julien Grall
[not found] ` <59C2603C020000780017D561@suse.com>
2017-09-20 11:10 ` Juergen Gross
2017-09-20 11:48 ` Jan Beulich
[not found] ` <59C271B9020000780017D620@suse.com>
2017-09-20 12:44 ` Juergen Gross
2017-09-20 15:35 ` Jan Beulich
[not found] ` <59C2A6DE020000780017D874@suse.com>
2017-09-21 4:35 ` Juergen Gross
2017-09-21 6:15 ` Jan Beulich
[not found] ` <59C3751D020000780017DCB6@suse.com>
2017-09-21 7:53 ` Juergen Gross
2017-09-21 11:31 ` Jan Beulich
[not found] ` <59C3BF28020000780017DE68@suse.com>
2017-09-21 11:39 ` Juergen Gross
2017-09-21 11:48 ` Jan Beulich
[not found] ` <59C3C33E020000780017DEC3@suse.com>
2017-09-21 11:51 ` Juergen Gross
2017-09-22 6:19 ` Juergen Gross
2017-09-22 7:53 ` Jan Beulich
[not found] ` <59C4DD9B020000780017E575@suse.com>
2017-09-22 8:27 ` Juergen Gross
2017-09-22 8:35 ` Jan Beulich
[not found] ` <59C4E78B020000780017E67D@suse.com>
2017-09-22 8:44 ` Juergen Gross
2017-09-22 8:51 ` Jan Beulich
2017-09-20 6:34 ` Juergen Gross [this message]
2017-09-20 12:07 ` [PATCH v8 14/15] xen: make grant table limits boot parameters dom0 only Jan Beulich
[not found] ` <59C27619020000780017D66F@suse.com>
2017-09-20 12:48 ` Juergen Gross
2017-09-20 15:36 ` Jan Beulich
[not found] ` <59C2A72D020000780017D881@suse.com>
2017-09-21 4:27 ` Juergen Gross
2017-09-21 6:16 ` Jan Beulich
2017-09-20 6:34 ` [PATCH v8 15/15] xen: add new Xen cpuid node for max address width info Juergen Gross
2017-09-20 12:18 ` Jan Beulich
[not found] ` <59C278A3020000780017D689@suse.com>
2017-09-20 12:58 ` Juergen Gross
2017-09-20 15:42 ` Jan Beulich
[not found] ` <59C2A880020000780017D8A2@suse.com>
2017-09-21 4:21 ` Juergen Gross
2017-09-20 13:00 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170920063430.9105-15-jgross@suse.com \
--to=jgross@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).