mbox series

[v4,0/4] Support for reading runtime hypervisor parameters

Message ID 20190528145416.16918-1-vliaskovitis@suse.com (mailing list archive)
Headers show
Series Support for reading runtime hypervisor parameters | expand

Message

Vasilis LIaskovitis May 28, 2019, 2:54 p.m. UTC
Currently runtime parameters of the hypervisor cannot be inspected through an
xl command, however they can be changed with the "xl set-parameter" command.
Being able to check these parameters at runtime would be a useful diagnostic
tool.

This patch series implements a new xl command "xl get-parameters"
which takes a string of input parameters and returns their current
values in the hypervisor settings.

Examples:

xl get-parameters "gnttab_max_frames gnttab_max_maptrack_frames"
gnttab_max_frames gnttab_max_maptrack_frames : 64 1024

xl set-parameters gnttab_max_frames=128

xl get-parameters gnttab_max_frames
gnttab_max_frames : 128

xl get-parameters "gnttab_max_frames gnttab_max_maptrack_frames"
gnttab_max_frames gnttab_max_maptrack_frames : 128 1024


Changes v3->v4:

- Fix return value and logging in new libxl function.

Changes v2->v3:

- Several style / formatting fixes
- Limitations for signed integer parameters added in code and commit log.

Changes v1->v2:

- fixed snprintf issues, fixed memory leaks and error handling
- removed unnecessary wrapper function
- OPT_SIZE is handled

Limitations:

- Custom runtime parameters (OPT_CUSTOM) are not supported yet. I'd like
  to do this in a follow-up series. See also discussion at
  https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg01383.html
- For integer parameters (OPT_UINT), only unsigned parameters are printed
  correctly at the moment.

Vasilis Liaskovitis (4):
  xen: add hypercall for getting parameters at runtime
  libxc: add function to get hypervisor parameters
  libxl: add libxl_get_parameters() function
  xl: add new xl command get-parameters

 docs/man/xl.1.pod.in                |   5 ++
 tools/flask/policy/modules/dom0.te  |   2 +-
 tools/libxc/include/xenctrl.h       |   1 +
 tools/libxc/xc_misc.c               |  26 ++++++
 tools/libxl/libxl.c                 |  19 +++++
 tools/libxl/libxl.h                 |   1 +
 tools/xl/xl.h                       |   1 +
 tools/xl/xl_cmdtable.c              |   5 ++
 tools/xl/xl_misc.c                  |  25 ++++++
 xen/common/kernel.c                 | 118 ++++++++++++++++++++++++++++
 xen/common/sysctl.c                 |  52 +++++++++++-
 xen/include/public/sysctl.h         |  18 +++++
 xen/include/xen/lib.h               |   1 +
 xen/xsm/flask/hooks.c               |   3 +
 xen/xsm/flask/policy/access_vectors |   2 +
 15 files changed, 276 insertions(+), 3 deletions(-)

Comments

Jürgen Groß July 15, 2019, 4:27 a.m. UTC | #1
On 28.05.19 16:54, Vasilis Liaskovitis wrote:
> Currently runtime parameters of the hypervisor cannot be inspected through an
> xl command, however they can be changed with the "xl set-parameter" command.
> Being able to check these parameters at runtime would be a useful diagnostic
> tool.
> 
> This patch series implements a new xl command "xl get-parameters"
> which takes a string of input parameters and returns their current
> values in the hypervisor settings.
> 
> Examples:
> 
> xl get-parameters "gnttab_max_frames gnttab_max_maptrack_frames"
> gnttab_max_frames gnttab_max_maptrack_frames : 64 1024
> 
> xl set-parameters gnttab_max_frames=128
> 
> xl get-parameters gnttab_max_frames
> gnttab_max_frames : 128
> 
> xl get-parameters "gnttab_max_frames gnttab_max_maptrack_frames"
> gnttab_max_frames gnttab_max_maptrack_frames : 128 1024
> 
> 
> Changes v3->v4:
> 
> - Fix return value and logging in new libxl function.
> 
> Changes v2->v3:
> 
> - Several style / formatting fixes
> - Limitations for signed integer parameters added in code and commit log.
> 
> Changes v1->v2:
> 
> - fixed snprintf issues, fixed memory leaks and error handling
> - removed unnecessary wrapper function
> - OPT_SIZE is handled
> 
> Limitations:
> 
> - Custom runtime parameters (OPT_CUSTOM) are not supported yet. I'd like
>    to do this in a follow-up series. See also discussion at
>    https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg01383.html
> - For integer parameters (OPT_UINT), only unsigned parameters are printed
>    correctly at the moment.
> 
> Vasilis Liaskovitis (4):
>    xen: add hypercall for getting parameters at runtime
>    libxc: add function to get hypervisor parameters
>    libxl: add libxl_get_parameters() function
>    xl: add new xl command get-parameters
> 
>   docs/man/xl.1.pod.in                |   5 ++
>   tools/flask/policy/modules/dom0.te  |   2 +-
>   tools/libxc/include/xenctrl.h       |   1 +
>   tools/libxc/xc_misc.c               |  26 ++++++
>   tools/libxl/libxl.c                 |  19 +++++
>   tools/libxl/libxl.h                 |   1 +
>   tools/xl/xl.h                       |   1 +
>   tools/xl/xl_cmdtable.c              |   5 ++
>   tools/xl/xl_misc.c                  |  25 ++++++
>   xen/common/kernel.c                 | 118 ++++++++++++++++++++++++++++
>   xen/common/sysctl.c                 |  52 +++++++++++-
>   xen/include/public/sysctl.h         |  18 +++++
>   xen/include/xen/lib.h               |   1 +
>   xen/xsm/flask/hooks.c               |   3 +
>   xen/xsm/flask/policy/access_vectors |   2 +
>   15 files changed, 276 insertions(+), 3 deletions(-)
> 

At the Xen developers summit last week in Chicago there was a related
discussion. The basic outcome was that there is some need for a generic
framework to report hypervisor settings to dom0, especially for the
currently active mitigation settings of cpu vulnerabilities. The most
appropriate solution seems to be a hierarchical key-value store in the
hypervisor which can be queried via a new interface. The same interface
would be usable for reading hypervisor parameters, too.


Juergen