linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] KVM: x86: add support for VMX TSC scaling
@ 2015-09-28  5:37 Haozhong Zhang
  2015-09-28  5:38 ` [PATCH 01/12] KVM: x86: Collect information for setting TSC scaling ratio Haozhong Zhang
                   ` (12 more replies)
  0 siblings, 13 replies; 30+ messages in thread
From: Haozhong Zhang @ 2015-09-28  5:37 UTC (permalink / raw)
  To: kvm
  Cc: Gleb Natapov, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, Joerg Roedel, Wanpeng Li, Xiao Guangrong,
	Mihai Donțu, Andy Lutomirski, Kai Huang, linux-kernel,
	Haozhong Zhang

This patchset adds support for VMX TSC scaling feature which is
available on Intel Skylake CPU. The specification of VMX TSC scaling
can be found at
http://www.intel.com/content/www/us/en/processors/timestamp-counter-scaling-virtualization-white-paper.html

VMX TSC scaling allows guest TSC which is read by guest rdtsc(p)
instructions increases in a rate that is customized by the hypervisor
and can be different than the host TSC rate. Basically, VMX TSC
scaling adds a 64-bit field called TSC multiplier in VMCS so that, if
VMX TSC scaling is enabled, TSC read by guest rdtsc(p) instructions
will be calculated by the following formula:

  guest EDX:EAX = (Host TSC * TSC multiplier) >> 48 + VMX TSC Offset

where, Host TSC = Host MSR_IA32_TSC + Host MSR_IA32_TSC_ADJUST.

This patchset, when cooperating with another QEMU patchset (sent in
another email "target-i386: save/restore vcpu's TSC rate during
migration"), allows guest programs observe a consistent TSC rate even
though they are migrated among machines with different host TSC rates.

VMX TSC scaling shares some common logics with SVM TSC scaling which
is already supported by KVM. Patch 1 ~ 8 move those common logics from
SVM code to the common code. Upon them, patch 9 ~ 12 add VMX-specific
support for VMX TSC scaling.

Haozhong Zhang (12):
  KVM: x86: Collect information for setting TSC scaling ratio
  KVM: x86: Add a common TSC scaling ratio field in kvm_vcpu_arch
  KVM: x86: Add a common TSC scaling function
  KVM: x86: Replace call-back set_tsc_khz() with a common function
  KVM: x86: Replace call-back compute_tsc_offset() with a common function
  KVM: x86: Move TSC scaling logic out of call-back adjust_tsc_offset()
  KVM: x86: Move TSC scaling logic out of call-back read_l1_tsc()
  KVM: x86: Use the correct vcpu's TSC rate to compute time scale
  KVM: VMX: Enable and initialize VMX TSC scaling
  KVM: VMX: Setup TSC scaling ratio when a vcpu is loaded
  KVM: VMX: Use a scaled host TSC for guest readings of MSR_IA32_TSC
  KVM: VMX: Dump TSC multiplier in dump_vmcs()

 arch/x86/include/asm/kvm_host.h |  24 +++----
 arch/x86/include/asm/vmx.h      |   4 +-
 arch/x86/kvm/lapic.c            |   5 +-
 arch/x86/kvm/svm.c              | 113 +++--------------------------
 arch/x86/kvm/vmx.c              |  60 ++++++++--------
 arch/x86/kvm/x86.c              | 154 +++++++++++++++++++++++++++++++++++++---
 include/linux/kvm_host.h        |  21 +++++-
 7 files changed, 221 insertions(+), 160 deletions(-)

--
2.4.8


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

end of thread, other threads:[~2015-10-06 11:32 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28  5:37 [PATCH 00/12] KVM: x86: add support for VMX TSC scaling Haozhong Zhang
2015-09-28  5:38 ` [PATCH 01/12] KVM: x86: Collect information for setting TSC scaling ratio Haozhong Zhang
2015-09-29  3:28   ` Eric Northup
2015-09-29  4:01     ` Haozhong Zhang
2015-09-28  5:38 ` [PATCH 02/12] KVM: x86: Add a common TSC scaling ratio field in kvm_vcpu_arch Haozhong Zhang
2015-10-05 19:26   ` Radim Krčmář
2015-10-06  1:54     ` Haozhong Zhang
2015-09-28  5:38 ` [PATCH 03/12] KVM: x86: Add a common TSC scaling function Haozhong Zhang
2015-09-28 20:12   ` Paolo Bonzini
2015-09-29  1:51     ` Haozhong Zhang
2015-09-28  5:38 ` [PATCH 04/12] KVM: x86: Replace call-back set_tsc_khz() with a common function Haozhong Zhang
     [not found]   ` <CAG7+5M3z2-OKsy0wxxks2oW9+7WmFpO4JQETTx3KsaW-hWMGqw@mail.gmail.com>
2015-09-29  3:47     ` Haozhong Zhang
2015-10-05 19:53   ` Radim Krčmář
2015-10-05 20:46     ` David Matlack
2015-10-06  4:06     ` Haozhong Zhang
2015-10-06 10:40       ` Paolo Bonzini
2015-10-06 11:32         ` Haozhong Zhang
2015-09-28  5:38 ` [PATCH 05/12] KVM: x86: Replace call-back compute_tsc_offset() " Haozhong Zhang
2015-09-28  5:38 ` [PATCH 06/12] KVM: x86: Move TSC scaling logic out of call-back adjust_tsc_offset() Haozhong Zhang
2015-09-28 20:14   ` Paolo Bonzini
2015-09-29  1:47     ` Haozhong Zhang
2015-09-28  5:38 ` [PATCH 07/12] KVM: x86: Move TSC scaling logic out of call-back read_l1_tsc() Haozhong Zhang
2015-09-28  5:38 ` [PATCH 08/12] KVM: x86: Use the correct vcpu's TSC rate to compute time scale Haozhong Zhang
2015-10-05 20:12   ` Radim Krčmář
2015-09-28  5:38 ` [PATCH 09/12] KVM: VMX: Enable and initialize VMX TSC scaling Haozhong Zhang
2015-09-28  5:38 ` [PATCH 10/12] KVM: VMX: Setup TSC scaling ratio when a vcpu is loaded Haozhong Zhang
2015-09-28  5:38 ` [PATCH 11/12] KVM: VMX: Use a scaled host TSC for guest readings of MSR_IA32_TSC Haozhong Zhang
2015-09-28  5:38 ` [PATCH 12/12] KVM: VMX: Dump TSC multiplier in dump_vmcs() Haozhong Zhang
2015-09-29  4:00 ` [PATCH 00/12] KVM: x86: add support for VMX TSC scaling Eric Northup
2015-09-29  4:03   ` Haozhong Zhang

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).