KVM: s390: no timer interrupts when single-stepping a guest
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Tue, 18 Mar 2014 09:06:14 +0000 (10:06 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 22 Apr 2014 11:24:52 +0000 (13:24 +0200)
When a guest is single-stepped, we want to disable timer interrupts. Otherwise,
the guest will continuously execute the external interrupt handler and make
debugging of code where timer interrupts are enabled almost impossible.

The delivery of timer interrupts can be enforced in such sections by setting a
breakpoint and continuing execution.

In order to disable timer interrupts, they are disabled in the control register
of the guest just before SIE entry and are suppressed in the interrupt
check/delivery methods.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/guestdbg.c
arch/s390/kvm/interrupt.c

index 100e99d1030d038b547a1eeb91e014f1bc113294..757ccef62fd59257077769345f16a0746dccb254 100644 (file)
@@ -155,6 +155,8 @@ void kvm_s390_patch_guest_per_regs(struct kvm_vcpu *vcpu)
         */
 
        if (guestdbg_sstep_enabled(vcpu)) {
+               /* disable timer (clock-comparator) interrupts */
+               vcpu->arch.sie_block->gcr[0] &= ~0x800ul;
                vcpu->arch.sie_block->gcr[9] |= PER_EVENT_IFETCH;
                vcpu->arch.sie_block->gcr[10] = 0;
                vcpu->arch.sie_block->gcr[11] = PSW_ADDR_INSN;
index 0165f1b089ac92c456cd2d2977849168ce17fe4f..d020c5f8eabbd7e7e2b0b01e8185152585317d85 100644 (file)
@@ -61,6 +61,9 @@ static int ckc_interrupts_enabled(struct kvm_vcpu *vcpu)
        if (psw_extint_disabled(vcpu) ||
            !(vcpu->arch.sie_block->gcr[0] & 0x800ul))
                return 0;
+       if (guestdbg_enabled(vcpu) && guestdbg_sstep_enabled(vcpu))
+               /* No timer interrupts when single stepping */
+               return 0;
        return 1;
 }