linux/arch/s390/kvm
David Hildenbrand 2d00f75942 KVM: s390: forward hrtimer if guest ckc not pending yet
Patch 0759d0681c ("KVM: s390: cleanup handle_wait by reusing
kvm_vcpu_block") changed the way pending guest clock comparator
interrupts are detected. It was assumed that as soon as the hrtimer
wakes up, the condition for the guest ckc is satisfied.

This is however only true as long as adjclock() doesn't speed
up the monotonic clock. Reason is that the hrtimer is based on
CLOCK_MONOTONIC, the guest clock comparator detection is based
on the raw TOD clock. If CLOCK_MONOTONIC runs faster than the
TOD clock, the hrtimer wakes the target VCPU up too early and
the target VCPU will not detect any pending interrupts, therefore
going back to sleep. It will never be woken up again because the
hrtimer has finished. The VCPU is stuck.

As a quick fix, we have to forward the hrtimer until the guest
clock comparator is really due, to guarantee properly timed wake
ups.

As the hrtimer callback might be triggered on another cpu, we
have to make sure that the timer is really stopped and not currently
executing the callback on another cpu. This can happen if the vcpu
thread is scheduled onto another physical cpu, but the timer base
is not migrated. So lets use hrtimer_cancel instead of try_to_cancel.

A proper fix might be to introduce a RAW based hrtimer.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-01-23 13:25:32 +01:00
..
diag.c KVM: s390/cmm: Fix prefix handling for diag 10 balloon 2014-09-10 12:19:42 +02:00
gaccess.c kernel: Provide READ_ONCE and ASSIGN_ONCE 2014-12-20 16:48:59 -08:00
gaccess.h KVM: s390: Enable DAT support for TPROT handler 2014-05-30 09:39:36 +02:00
guestdbg.c KVM: s390: return -EFAULT if copy_from_user() fails 2014-05-06 14:57:59 +02:00
intercept.c KVM: s390: handle pending local interrupts via bitmap 2014-11-28 13:59:04 +01:00
interrupt.c KVM: s390: forward hrtimer if guest ckc not pending yet 2015-01-23 13:25:32 +01:00
irq.h KVM: s390: irq routing for adapter interrupts. 2014-03-21 13:43:00 +01:00
Kconfig KVM: Give IRQFD its own separate enabling Kconfig option 2014-08-05 14:26:28 +02:00
kvm-s390.c KVM: s390: base hrtimer on a monotonic clock 2015-01-23 13:25:32 +01:00
kvm-s390.h KVM: s390: handle pending local interrupts via bitmap 2014-11-28 13:59:04 +01:00
Makefile KVM: s390: hardware support for guest debugging 2014-04-22 13:24:51 +02:00
priv.c 3.19 changes for KVM: 2014-12-18 16:05:28 -08:00
sigp.c KVM: s390: handle pending local interrupts via bitmap 2014-11-28 13:59:04 +01:00
trace-s390.h KVM: s390: enable IBS for single running VCPUs 2014-04-29 15:01:54 +02:00
trace.h KVM: s390: interpretive execution of SIGP EXTERNAL CALL 2014-05-16 14:57:28 +02:00