diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2016-04-04 16:46:07 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-04-05 14:19:08 +0200 |
commit | 61abdbe0bcc2b32745ab4479cc550f4c1f518ee2 (patch) | |
tree | 090453c4f201a43a08e0f3d9b8524e3c91a639f2 /firmware/myricom/lanai.bin.ihex | |
parent | 9c650d09a9c3029cc90cae5d2cd7ab131bdb86c2 (diff) | |
download | linux-61abdbe0bcc2b32745ab4479cc550f4c1f518ee2.tar.bz2 |
kvm: x86: make lapic hrtimer pinned
When a vCPU runs on a nohz_full core, the hrtimer used by
the lapic emulation code can be migrated to another core.
When this happens, it's possible to observe milisecond
latency when delivering timer IRQs to KVM guests.
The huge latency is mainly due to the fact that
apic_timer_fn() expects to run during a kvm exit. It
sets KVM_REQ_PENDING_TIMER and let it be handled on kvm
entry. However, if the timer fires on a different core,
we have to wait until the next kvm exit for the guest
to see KVM_REQ_PENDING_TIMER set.
This problem became visible after commit 9642d18ee. This
commit changed the timer migration code to always attempt
to migrate timers away from nohz_full cores. While it's
discussable if this is correct/desirable (I don't think
it is), it's clear that the lapic emulation code has
a requirement on firing the hrtimer in the same core
where it was started. This is achieved by making the
hrtimer pinned.
Lastly, note that KVM has code to migrate timers when a
vCPU is scheduled to run in different core. However, this
forced migration may fail. When this happens, we can have
the same problem. If we want 100% correctness, we'll have
to modify apic_timer_fn() to cause a kvm exit when it runs
on a different core than the vCPU. Not sure if this is
possible.
Here's a reproducer for the issue being fixed:
1. Set all cores but core0 to be nohz_full cores
2. Start a guest with a single vCPU
3. Trace apic_timer_fn() and kvm_inject_apic_timer_irqs()
You'll see that apic_timer_fn() will run in core0 while
kvm_inject_apic_timer_irqs() runs in a different core. If
you get both on core0, try running a program that takes 100%
of the CPU and pin it to core0 to force the vCPU out.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'firmware/myricom/lanai.bin.ihex')
0 files changed, 0 insertions, 0 deletions