summaryrefslogtreecommitdiffstats
path: root/mm/percpu-km.c
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2018-01-25 14:20:19 +0100
committerChristoffer Dall <christoffer.dall@linaro.org>2018-01-31 10:10:17 +0100
commit13e59ece5b30f39e4e1e1fac2b2ddc7ed527f3cc (patch)
treea64576430832223e0b152170f62dd9ef17692b47 /mm/percpu-km.c
parentb276f1b3b1eb52697f6645bb98f7d32ffb89df69 (diff)
downloadlinux-13e59ece5b30f39e4e1e1fac2b2ddc7ed527f3cc.tar.bz2
KVM: arm/arm64: Fix incorrect timer_is_pending logic
After the recently introduced support for level-triggered mapped interrupt, I accidentally left the VCPU thread busily going back and forward between the guest and the hypervisor whenever the guest was blocking, because I would always incorrectly report that a timer interrupt was pending. This is because the timer->irq.level field is not valid for mapped interrupts, where we offload the level state to the hardware, and as a result this field is always true. Luckily the problem can be relatively easily solved by not checking the cached signal state of either timer in kvm_timer_should_fire() but instead compute the timer state on the fly, which we do already if the cached signal state wasn't high. In fact, the only reason for checking the cached signal state was a tiny optimization which would only be potentially faster when the polling loop detects a pending timer interrupt, which is quite unlikely. Instead of duplicating the logic from kvm_arch_timer_handler(), we enlighten kvm_timer_should_fire() to report something valid when the timer state is loaded onto the hardware. We can then call this from kvm_arch_timer_handler() as well and avoid the call to __timer_snapshot_state() in kvm_arch_timer_get_input_level(). Reported-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Tomasz Nowicki <tn@semihalf.com> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'mm/percpu-km.c')
0 files changed, 0 insertions, 0 deletions