[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Wed, 20 Jan 2021 17:49:08 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y6hgIzpmWFihpRvpiTwYRDgI6KEJ6O5ZlUXasnWJg1o=; b=koQZ8U3sn9qX3xWzyTsvEf0qVKBsRb9yOZDp/9EcEPXXoRDuNrYgY+KzIG/9XASUJxOCfNL/sCv+dBhfRTUEv5aOnVTpN4+VoAaehHcsSk5VFu9pNqiiZmuxOSYVmB9Ufqq9ulR7Hl0uB9P+YaJiW1Ln2qkKcG6aN4QfduvnAFwrPtnJAzDwbaDaKPKi2x0peomsc2++Vm6D9/fbkRR/qBw9SiyGmViEKCxuQkqnpM0bUJrn8IjNL3jHr+veV13VeqcCNa7a2y+XD+jUXuGmLPvPFhCKfdAuwJEgNkrwjmCQt0gQLbVQcbrVmgi8g5Vottcp+S9+ybU6F6FvkBCrGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WXCP5PFGTC604egdmnHRyVS96IfEMakuCvEeW5a1sX3MIdFM9WOovpk5sEa/InfCmhM7p6Tf7MqvAzXrKRITXrJ8zZIBOgNF1iad2EYDW+gS12fU2OKtkmK6V6NhNlkSeAQIFNy5Ysdyu1pWSnKjzQZ8Wmp1QbvIVL3Me5jLtkJ0vEmEfjsbjv7MyGS9hZfnG5cECS+1iE8SEFHEvwvjkap2otd8bhrn1yT0WlfYRSUbK2VVn50FPZABTc1e69iOGPVYGkyZN3p51coz+2bNkb2R3t1T7VKF23Dvjh1bULMZaGKhvHbfFyLa5UDagtTm7MLw0Ir1f0I/lAZNAm7POw==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=oracle.com;
  • Cc: iwj@xxxxxxxxxxxxxx, wl@xxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, jun.nakajima@xxxxxxxxx, kevin.tian@xxxxxxxxx, boris.ostrovsky@xxxxxxxxxx
  • Delivery-date: Wed, 20 Jan 2021 22:49:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.