diff options
author | Christoffer Dall <christoffer.dall@arm.com> | 2019-04-25 14:57:40 +0200 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2019-04-25 15:13:31 +0200 |
commit | 6bc210003dff7b789efae5bb02a0320dc24dd416 (patch) | |
tree | 0960f6a4c5f15cb7fd454ac05a9bceba5c84951a /kernel/async.c | |
parent | kvm: arm: Skip stage2 huge mappings for unaligned ipa backed by THP (diff) | |
download | linux-6bc210003dff7b789efae5bb02a0320dc24dd416.tar.xz linux-6bc210003dff7b789efae5bb02a0320dc24dd416.zip |
KVM: arm/arm64: Don't emulate virtual timers on userspace ioctls
When a VCPU never runs before a guest exists, but we set timer registers
up via ioctls, the associated hrtimer might never get cancelled.
Since we moved vcpu_load/put into the arch-specific implementations and
only have load/put for KVM_RUN, we won't ever have a scheduled hrtimer
for emulating a timer when modifying the timer state via an ioctl from
user space. All we need to do is make sure that we pick up the right
state when we load the timer state next time userspace calls KVM_RUN
again.
We also do not need to worry about this interacting with the bg_timer,
because if we were in WFI from the guest, and somehow ended up in a
kvm_arm_timer_set_reg, it means that:
1. the VCPU thread has received a signal,
2. we have called vcpu_load when being scheduled in again,
3. we have called vcpu_put when we returned to userspace for it to issue
another ioctl
And therefore will not have a bg_timer programmed and the event is
treated as a spurious wakeup from WFI if userspace decides to run the
vcpu again even if there are not virtual interrupts.
This fixes stray virtual timer interrupts triggered by an expiring
hrtimer, which happens after a failed live migration, for instance.
Fixes: bee038a674875 ("KVM: arm/arm64: Rework the timer code to use a timer_map")
Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
Reported-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'kernel/async.c')
0 files changed, 0 insertions, 0 deletions