diff mbox

[v4,5/8] xen: double default grant frame limit for huge hosts

Message ID 20170907134735.20434-6-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Sept. 7, 2017, 1:47 p.m. UTC
In case a system has memory above the 16TB boundary double the default
grant frame number limit per domain. This ensures a pv domain can still
establish the same number of grants even if it is required to use
version 2 grants which need twice the space of v1 grants.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/common/grant_table.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ff735a4b47..c00119f2fe 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -3824,8 +3824,15 @@  static int __init gnttab_usage_init(void)
 {
     BUILD_BUG_ON(DEFAULT_MAX_MAPTRACK_FRAMES < DEFAULT_MAX_NR_GRANT_FRAMES);
 
+    /*
+     * In case grant v2 is required for pv domains to reference any possible
+     * memory page (i.e. memory is installed above 16TB boundary) double the
+     * grant frame limit. This will allow a guest using v2 grants without
+     * having to lower the number of usable grants.
+     */
     if ( !max_grant_frames )
-        max_grant_frames = DEFAULT_MAX_NR_GRANT_FRAMES;
+        max_grant_frames = ((max_page >> 32) ? 2 : 1) *
+                           DEFAULT_MAX_NR_GRANT_FRAMES;
 
     if ( !max_maptrack_frames )
         max_maptrack_frames = DEFAULT_MAX_MAPTRACK_FRAMES;