Message ID | 20170906124653.5408-6-jgross@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Sep 06, 2017 at 02:46:50PM +0200, Juergen Gross wrote: > 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>
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;