linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/6] KVM: VMX: Intel PT configuration switch using XSAVES/XRSTORS on VM-Entry/Exit
@ 2019-05-16  8:25 Luwei Kang
  2019-05-16  8:25 ` [PATCH v1 1/6] x86/fpu: Introduce new fpu state for Intel processor trace Luwei Kang
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Luwei Kang @ 2019-05-16  8:25 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: tglx, mingo, bp, hpa, x86, pbonzini, rkrcmar, Luwei Kang

This patch set is mainly used for reduce the overhead of switch
Intel PT configuation contex on VM-Entry/Exit by XSAVES/XRSTORS
instructions.

I measured the cycles number of context witch on Manual and
XSAVES/XRSTORES by rdtsc, and the data as below:

Manual save(rdmsr):     ~334  cycles
Manual restore(wrmsr):  ~1668 cycles

XSAVES insturction:     ~124  cycles
XRSTORS instruction:    ~378  cycles

Manual: Switch the configuration by rdmsr and wrmsr instruction,
        and there have 8 registers need to be saved or restore.
        They are IA32_RTIT_OUTPUT_BASE, *_OUTPUT_MASK_PTRS,
        *_STATUS, *_CR3_MATCH, *_ADDR0_A, *_ADDR0_B,
        *_ADDR1_A, *_ADDR1_B.
XSAVES/XRSTORS: Switch the configuration context by XSAVES/XRSTORS
        instructions. This patch set will allocate separate
        "struct fpu" structure to save host and guest PT state.
        Only a small portion of this structure will be used because
        we only save/restore PT state (not save AVX, AVX-512, MPX,
        PKRU and so on).

This patch set also do some code clean e.g. patch 2 will reuse
the fpu pt_state to save the PT configuration contex and
patch 3 will dymamic allocate Intel PT configuration state.

Luwei Kang (6):
  x86/fpu: Introduce new fpu state for Intel processor trace
  KVM: VMX: Reuse the pt_state structure for PT context
  KVM: VMX: Dymamic allocate Intel PT configuration state
  KVM: VMX: Allocate XSAVE area for Intel PT configuration
  KVM: VMX: Intel PT configration context switch using XSAVES/XRSTORS
  KVM: VMX: Get PT state from xsave area to variables

 arch/x86/include/asm/fpu/types.h |  13 ++
 arch/x86/kvm/vmx/nested.c        |   2 +-
 arch/x86/kvm/vmx/vmx.c           | 338 ++++++++++++++++++++++++++-------------
 arch/x86/kvm/vmx/vmx.h           |  21 +--
 4 files changed, 243 insertions(+), 131 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-11 13:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16  8:25 [PATCH v1 0/6] KVM: VMX: Intel PT configuration switch using XSAVES/XRSTORS on VM-Entry/Exit Luwei Kang
2019-05-16  8:25 ` [PATCH v1 1/6] x86/fpu: Introduce new fpu state for Intel processor trace Luwei Kang
2019-05-16  8:25 ` [PATCH v1 2/6] KVM: VMX: Reuse the pt_state structure for PT context Luwei Kang
2019-05-16  8:25 ` [PATCH v1 3/6] KVM: VMX: Dymamic allocate Intel PT configuration state Luwei Kang
2019-05-16  8:25 ` [PATCH v1 4/6] KVM: VMX: Allocate XSAVE area for Intel PT configuration Luwei Kang
2019-05-16  8:25 ` [PATCH v1 5/6] KVM: VMX: Intel PT configration context switch using XSAVES/XRSTORS Luwei Kang
2019-05-16  8:25 ` [PATCH v1 6/6] KVM: VMX: Get PT state from xsave area to variables Luwei Kang
2019-11-11 13:28 ` [PATCH v1 0/6] KVM: VMX: Intel PT configuration switch using XSAVES/XRSTORS on VM-Entry/Exit Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).