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

[RFC PATCH v2 00/10] Virtualize architectural LBRs



Intel model-specific last branch records (LBRs) were replaced by
architectural LBRs (see Chapter 20 of Intel SDM volume 3B). This
patchset implements virtual LBRs for HVM guests using Intel's "load
guest IA32_LBR_CTL" and "clear IA32_LBR_CTL" VMX controls. It
dynamically intercepts accesses to LBR state to translate between linear
and effective IP depending on the current host CPU core type.

The v2 patchset implements LBR state support in Xen's xstate handling.
Additionally, it adds XSAVES/XRSTORS support to the x86 emulator.
Finally, migration is handled by adding a new HVM save code
CPU_XSAVES_CODE containing a vCPU's compacted xstates as written by
XSAVES.

I'm looking for feedback on emulator handling of XSAVES/XRSTORS,
especially concerning FPU bits as it's not clear to me what should be
done in these cases.

Tu Dinh (10):
  x86: Add architectural LBR definitions
  x86: Define arch LBR feature bits
  tools: Add arch LBR feature bits
  x86: Calculate arch LBR CPUID policies
  x86: Keep a copy of XSAVE area size
  x86: Enable XSTATE save/restore for arch LBR
  x86/hvm: Don't count XSS bits in XSAVE size
  x86/emulate: Implement XSAVES/XRSTORS for arch LBR
  x86/vmx: Implement arch LBR
  x86/hvm: Enable XSAVES LBR save/restore

 tools/libs/light/libxl_cpuid.c              |   3 +
 tools/misc/xen-cpuid.c                      |   3 +
 tools/tests/x86_emulator/x86-emulate.h      |   2 +
 xen/arch/x86/cpu-policy.c                   |  28 +++
 xen/arch/x86/cpu/common.c                   |   7 +
 xen/arch/x86/domain.c                       |   7 +
 xen/arch/x86/hvm/emulate.c                  |  11 +
 xen/arch/x86/hvm/hvm.c                      |  70 +++++-
 xen/arch/x86/hvm/vmx/vmcs.c                 |  11 +-
 xen/arch/x86/hvm/vmx/vmx.c                  | 203 +++++++++++++--
 xen/arch/x86/include/asm/cpufeature.h       |   5 +
 xen/arch/x86/include/asm/domain.h           |   1 +
 xen/arch/x86/include/asm/hvm/hvm.h          |   3 +
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h     |  11 +
 xen/arch/x86/include/asm/msr-index.h        |  12 +
 xen/arch/x86/include/asm/msr.h              |   5 +
 xen/arch/x86/include/asm/xstate.h           |  22 +-
 xen/arch/x86/msr.c                          |  89 ++++++-
 xen/arch/x86/x86_emulate/0fc7.c             | 260 ++++++++++++++------
 xen/arch/x86/x86_emulate/blk.c              | 142 +++++++++++
 xen/arch/x86/x86_emulate/private.h          |   8 +
 xen/arch/x86/x86_emulate/util-xen.c         |  14 ++
 xen/arch/x86/x86_emulate/x86_emulate.c      |  19 ++
 xen/arch/x86/x86_emulate/x86_emulate.h      |  33 +++
 xen/arch/x86/xstate.c                       |  83 +++++--
 xen/include/public/arch-x86/cpufeatureset.h |  28 ++-
 xen/include/public/arch-x86/hvm/save.h      |   4 +-
 xen/include/xen/lib/x86/cpu-policy.h        |  51 +++-
 xen/lib/x86/cpuid.c                         |   6 +
 29 files changed, 1013 insertions(+), 128 deletions(-)

-- 
2.43.0



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



 


Rackspace

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