On Tue, 14 Jun 2016 13:20:10 +0200 Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > > On 13/06/2016 23:19, Yunhong Jiang wrote: > > The VMX-preemption timer is a feature on VMX, it counts down, from > > the value loaded by VM entry, in VMX nonroot operation. When the > > timer counts down to zero, it stops counting down and a VM exit > > occurs. > > > > This patchset utilize VMX preemption timer for tsc deadline timer > > virtualization. The VMX preemption timer is armed before the > > vm-entry if the tsc deadline timer is enabled. A VMExit will happen > > if the virtual TSC deadline timer expires. > > > > When the vCPU thread is blocked because of HLT instruction, the tsc > > deadline timer virtualization will be switched to use the current > > solution, i.e. use the timer for it. It's switched back to VMX > > preemption timer when the vCPU thread is unblocked. > > > > This solution replace the complex OS's hrtimer system, and also the > > host timer interrupt handling cost, with a preemption_timer VMexit. > > It fits well for some NFV usage scenario, when the vCPU is bound to > > a pCPU and the pCPU is isolated, or some similar scenarioes. > > > > The benefits offset the small extra work to do on each VM-entry to > > setup the preemption timer > > I made a similar test with tscdeadline_latency from kvm-unit-tests. > With your patches: > > - we lose about ~20 clock cycles in the worst case where we HLT just > after programming the TSC deadline timer > > - we gain ~800 clock cycles (which is a 25% reduction in latency) in > the best case where the test busy waits. > > Good job! Thanks for your try a lot. --jyh -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html