]> xenbits.xensource.com Git - xen.git/commit
Rationalize max_grant_frames and max_maptrack_frames handling
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 6 Dec 2019 11:47:08 +0000 (12:47 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Dec 2019 11:47:08 +0000 (12:47 +0100)
commit54e30187085e52a3ec34319f03f8feda40bb65d4
treeb5a45034bdc363609f8abe3a6d9efac409077fc3
parent1e8932f0d815bee3102ede328676e1a4ca1926c7
Rationalize max_grant_frames and max_maptrack_frames handling

Xen used to have single, system-wide limits for the number of grant
frames and maptrack frames a guest was allowed to create. Increasing
or decreasing this single limit on the Xen command-line would change
the limit for all guests on the system.

Later, per-domain limits for these values was created. The system-wide
limits became strict limits: domains could not be created with higher
limits, but could be created with lower limits. However, that change
also introduced a range of different "default" values into various
places in the toolstack:

- The python libxc bindings hard-coded these values to 32 and 1024,
  respectively
- The libxl default values are 32 and 1024 respectively.
- xl will use the libxl default for maptrack, but does its own default
  calculation for grant frames: either 32 or 64, based on the max
  possible mfn.

These defaults interact poorly with the hypervisor command-line limit:

- The hypervisor command-line limit cannot be used to raise the limit
  for all guests anymore, as the default in the toolstack will
  effectively override this.
- If you use the hypervisor command-line limit to *reduce* the limit,
  then the "default" values generated by the toolstack are too high,
  and all guest creations will fail.

In other words, the toolstack defaults require any change to be
effected by having the admin explicitly specify a new value in every
guest.

In order to address this, have grant_table_init treat negative values
for max_grant_frames and max_maptrack_frames as instructions to use the
system-wide default, and have all the above toolstacks default to passing
-1 unless a different value is explicitly configured.

This restores the old behavior in that changing the hypervisor command-line
option can change the behavior for all guests, while retaining the ability
to set per-guest values.  It also removes the bug that reducing the
system-wide max will cause all domains without explicit limits to fail.

NOTE: - The Ocaml bindings require the caller to always specify a value,
        and the code to start a xenstored stubdomain hard-codes these to 4
and 128 respectively; this behavour will not be modified.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
master commit: f2ae59bc4b9b5c3f12de86aa42cdf413d2c3ffbf
master date: 2019-11-29 21:43:49 +0000
13 files changed:
docs/man/xl.conf.5.pod
tools/libxl/libxl.h
tools/libxl/libxl_types.idl
tools/libxl/libxlu_cfg.c
tools/libxl/libxlutil.h
tools/python/xen/lowlevel/xc/xc.c
tools/xl/xl.c
tools/xl/xl_parse.c
xen/arch/arm/setup.c
xen/arch/x86/setup.c
xen/common/grant_table.c
xen/include/public/domctl.h
xen/include/xen/grant_table.h