[PATCH v2 0/4] Permit fault-less access to non-emulated MSRs

Boris Ostrovsky posted 4 patches 3 years, 3 months ago
Test env passed
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/1611182952-9941-1-git-send-email-boris.ostrovsky@oracle.com
docs/man/xl.cfg.5.pod.in               |  20 +++++-
tools/include/xenctrl.h                |   2 +
tools/libs/guest/Makefile              |   1 +
tools/libs/guest/xg_msrs_x86.c         | 110 +++++++++++++++++++++++++++++++++
tools/libs/light/libxl_dom.c           |   5 +-
tools/libs/light/libxl_internal.h      |   2 +
tools/libs/light/libxl_types.idl       |   7 +++
tools/libs/light/libxl_x86.c           |   7 +++
tools/xl/xl_parse.c                    |   7 +++
xen/arch/x86/hvm/svm/svm.c             |  10 ++-
xen/arch/x86/hvm/vmx/vmx.c             |  10 ++-
xen/arch/x86/msr.c                     |  32 +++++++++-
xen/arch/x86/pv/emul-priv-op.c         |  10 +--
xen/arch/x86/x86_emulate/x86_emulate.h |   6 ++
xen/include/asm-x86/msr.h              |   3 +
xen/include/xen/lib/x86/msr.h          |  17 ++++-
xen/lib/x86/msr.c                      |   2 +
17 files changed, 229 insertions(+), 22 deletions(-)
create mode 100644 tools/libs/guest/xg_msrs_x86.c
[PATCH v2 0/4] Permit fault-less access to non-emulated MSRs
Posted by Boris Ostrovsky 3 years, 3 months ago
Disallowing accesses to MSRs that are not explicitly handled (done by
commit 84e848fd7a16 ("x86/hvm: disallow access to unknown MSRs")) caused
regression for Solaris guests who access MSR_RAPL_POWER_UNIT assuming
it's always there.

We can add special handling for this and other RAPL registers (and that's
what should happen for pre-4.14 releases) but a more general solution is to
provide an option to allow accesses to unhandled registers to proceed.

The new option is "ignore_msrs" and it can take three values
    never:   Issue a warning to the log and #GP to the guest. This is default.
    silent:  MSR reads return 0, MSR writes are ignored. No warnings to the log.
    verbose: Similar to silent but a warning is written.

v2:
* pass ignore_msrs in msr_policy's value filed, not flags
* use 0x400002ff as unhandled MSR
* make sure MSR policy is only consulted for guest's MSR acceses


Boris Ostrovsky (4):
  xl: Add support for ignore_msrs option
  x86: Introduce MSR_UNHANDLED
  x86: Allow non-faulting accesses to non-emulated MSRs if policy
    permits this
  tools/libs: Apply MSR policy to a guest

 docs/man/xl.cfg.5.pod.in               |  20 +++++-
 tools/include/xenctrl.h                |   2 +
 tools/libs/guest/Makefile              |   1 +
 tools/libs/guest/xg_msrs_x86.c         | 110 +++++++++++++++++++++++++++++++++
 tools/libs/light/libxl_dom.c           |   5 +-
 tools/libs/light/libxl_internal.h      |   2 +
 tools/libs/light/libxl_types.idl       |   7 +++
 tools/libs/light/libxl_x86.c           |   7 +++
 tools/xl/xl_parse.c                    |   7 +++
 xen/arch/x86/hvm/svm/svm.c             |  10 ++-
 xen/arch/x86/hvm/vmx/vmx.c             |  10 ++-
 xen/arch/x86/msr.c                     |  32 +++++++++-
 xen/arch/x86/pv/emul-priv-op.c         |  10 +--
 xen/arch/x86/x86_emulate/x86_emulate.h |   6 ++
 xen/include/asm-x86/msr.h              |   3 +
 xen/include/xen/lib/x86/msr.h          |  17 ++++-
 xen/lib/x86/msr.c                      |   2 +
 17 files changed, 229 insertions(+), 22 deletions(-)
 create mode 100644 tools/libs/guest/xg_msrs_x86.c

-- 
1.8.3.1