WSL2-Linux-Kernel/virt/kvm/arm
Marc Zyngier 1c5631c73f KVM: arm/arm64: Handle forward time correction gracefully
On a host that runs NTP, corrections can have a direct impact on
the background timer that we program on the behalf of a vcpu.

In particular, NTP performing a forward correction will result in
a timer expiring sooner than expected from a guest point of view.
Not a big deal, we kick the vcpu anyway.

But on wake-up, the vcpu thread is going to perform a check to
find out whether or not it should block. And at that point, the
timer check is going to say "timer has not expired yet, go back
to sleep". This results in the timer event being lost forever.

There are multiple ways to handle this. One would be record that
the timer has expired and let kvm_cpu_has_pending_timer return
true in that case, but that would be fairly invasive. Another is
to check for the "short sleep" condition in the hrtimer callback,
and restart the timer for the remaining time when the condition
is detected.

This patch implements the latter, with a bit of refactoring in
order to avoid too much code duplication.

Cc: <stable@vger.kernel.org>
Reported-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2016-04-06 13:17:54 +02:00
..
hyp KVM: arm/arm64: vgic-v2: Only wipe LRs on vcpu exit 2016-03-09 04:23:56 +00:00
arch_timer.c KVM: arm/arm64: Handle forward time correction gracefully 2016-04-06 13:17:54 +02:00
pmu.c arm64: KVM: Add braces to multi-line if statement in virtual PMU code 2016-04-01 13:30:55 +02:00
trace.h arm/arm64: KVM: Add tracepoints for vgic and timer 2015-10-22 23:01:48 +02:00
vgic-v2-emul.c KVM: arm/arm64: vgic-v2: Make GICD_SGIR quicker to hit 2016-03-09 04:24:03 +00:00
vgic-v2.c KVM: arm/arm64: vgic-v2: Reset LRs at boot time 2016-03-09 04:23:00 +00:00
vgic-v3-emul.c KVM: arm: vgic: Drop useless Group0 warning 2015-06-17 09:58:12 +01:00
vgic-v3.c arm64: KVM: vgic-v3: Reset LRs at boot time 2016-03-09 04:24:09 +00:00
vgic.c KVM: arm/arm64: vgic: Ensure bitmaps are long enough 2016-02-23 19:02:48 +00:00
vgic.h KVM: arm/arm64: rework MMIO abort handling to use KVM MMIO bus 2015-03-30 17:07:19 +01:00