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

[Xen-devel] [PATCH v3 0/3] x86/vmx: fix for vmentry failure with TSX bits in LBR



The first 2 patches is a general optimization which is nice to have
prior to the 3rd patch which contains the real fix.

A similar bug was fixed in Linux's perf subsystem in Jun 2016:

    commit 19fc9ddd61e059cc45464bdf6e8fa304bb94080f
    ("perf/x86/intel: Fix MSR_LAST_BRANCH_FROM_x bug when no TSX")

But the issue affects virtualized systems in a more severe way since
all LBR entries have to be fixed during vmentry.

v2 --> v3:
- Now "idx < *msr_count" is compared before "(*msr_area)[idx].index"
  in order to eliminate possible out-of-bounds access
- "vmx_" prefixes are removed from static symbols
- blank lines around lbr_tsx_fixup_enabled are added
- Renamed "LBR_FORMAT_MSR_IA32_PERF_CAP" --> "MSR_IA32_PERF_CAP_LBR_FORMAT"
- Removed "if" in lbr_tsx_fixup_enabled assignment

v1 --> v2:
- qsort (heap sort) is replaced with a variant of insertion sort
- both host and guest MSR lists are now kept sorted
- vmx_find_guest_msr() is replaced with more generic vmx_find_msr()
- factored out changes to vmx_read/write_guest_msr() into a separate patch
- LBR_FORMAT_MSR_IA32_PERF_CAP define is added
- enum for LBR_FORMAT_* is added
- LBR_FROM_SIGNEXT_2MSB is now a define instead of static const
- u32/64 replaced with uint32/64_t in vmx.c
- Renamed "last_in_from_ip" --> "lbr_lastint_from"
- Added defines for the layout of struct lbr_info[]
- Added a comment to vmx_lbr_tsx_fixup() about MSR array being sorted
- Fixed tabs for cpu_has_* defines
- arch_vmx_struct::lbr_tsx_fixup_enabled is moved to fill up 1-byte hole
- Made lbr_from_start, lbr_from_end and lbr_lastint_from
  global static __read_mostly.
  Moved their initialization into vmx_lbr_tsx_fixup_check().
- Information about Live Migration is added to the commit message of 3/3

Sergey Dyasli (3):
  x86/vmx: introduce vmx_find_msr()
  x86/vmx: optimize vmx_read/write_guest_msr()
  x86/vmx: fix vmentry failure with TSX bits in LBR

 xen/arch/x86/hvm/vmx/vmcs.c        | 71 +++++++++++++++++++++---------
 xen/arch/x86/hvm/vmx/vmx.c         | 90 ++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/cpufeature.h   |  3 ++
 xen/include/asm-x86/hvm/vmx/vmcs.h |  4 ++
 xen/include/asm-x86/msr-index.h    |  2 +
 5 files changed, 150 insertions(+), 20 deletions(-)

-- 
2.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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