Skip to content

Permit fault-less access to non-emulated MSRs

Boris Ostrovsky xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 48 repliesIn review
  2. v14 patches 8 repliesSuperseded

Changes in v2 from the cover letter

* 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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4xl: Add support for ignore_msrs optiondocs/man/xl.cfg.5.pod.in tools/libs/light/libxl_types.idl tools/xl/xl_parse.c+33 -114 replies
2/4x86: Introduce MSR_UNHANDLEDxen/arch/x86/msr.c xen/include/xen/lib/x86/msr.h xen/lib/x86/msr.c+20 -319 replies
3/4x86: Allow non-faulting accesses to non-emulated MSRs if policy permits thisxen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/msr.c +3 more+51 -1610 replies
4/4tools/libs: Apply MSR policy to a guesttools/include/xenctrl.h tools/libs/guest/Makefile tools/libs/guest/xg_msrs_x86.c +3 more+125 -25 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchWei Liu
1/4
2/4
3/4
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

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

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
Signature · 1 line
1.8.3.1