Commit c5ce823
KVM: VMX: Optimize tscdeadline timer latency
'Commit d0659d9 ("KVM: x86: add option to advance tscdeadline
hrtimer expiration")' advances the tscdeadline (the timer is emulated
by hrtimer) expiration in order that the latency which is incurred
by hypervisor (apic_timer_fn -> vmentry) can be avoided. This patch
adds the advance tscdeadline expiration support to which the tscdeadline
timer is emulated by VMX preemption timer to reduce the hypervisor
lantency (handle_preemption_timer -> vmentry). The guest can also
set an expiration that is very small (for example in Linux if an
hrtimer feeds a expiration in the past); in that case we set delta_tsc
to 0, leading to an immediately vmexit when delta_tsc is not bigger than
advance ns.
This patch can reduce ~63% latency (~4450 cycles to ~1660 cycles on
a haswell desktop) for kvm-unit-tests/tscdeadline_latency when testing
busy waits.
Cc: Paolo Bonzini <[email protected]>
Cc: Radim Krčmář <[email protected]>
Signed-off-by: Wanpeng Li <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>1 parent 71e9d9a commit c5ce823
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12435 | 12435 | | |
12436 | 12436 | | |
12437 | 12437 | | |
12438 | | - | |
| 12438 | + | |
12439 | 12439 | | |
12440 | 12440 | | |
12441 | 12441 | | |
| |||
12444 | 12444 | | |
12445 | 12445 | | |
12446 | 12446 | | |
| 12447 | + | |
| 12448 | + | |
| 12449 | + | |
| 12450 | + | |
| 12451 | + | |
| 12452 | + | |
12447 | 12453 | | |
12448 | 12454 | | |
12449 | 12455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
0 commit comments