KVM: s390: fix interrupt delivery
authorCarsten Otte <cotte@de.ibm.com>
Wed, 21 May 2008 11:37:37 +0000 (13:37 +0200)
committerAvi Kivity <avi@qumranet.com>
Fri, 6 Jun 2008 18:08:26 +0000 (21:08 +0300)
The current code delivers pending interrupts before it checks for
need_resched. On a busy host, this can lead to a longer interrupt
latency if the interrupt is injected while the process is scheduled
away. This patch moves delivering the interrupt _after_ schedule(),
which makes more sense.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/s390/kvm/kvm-s390.c

index 40e4f2d..ded27c7 100644 (file)
@@ -435,6 +435,8 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
        if (test_thread_flag(TIF_MCCK_PENDING))
                s390_handle_mcck();
 
+       kvm_s390_deliver_pending_interrupts(vcpu);
+
        vcpu->arch.sie_block->icptcode = 0;
        local_irq_disable();
        kvm_guest_enter();
@@ -480,7 +482,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
        might_sleep();
 
        do {
-               kvm_s390_deliver_pending_interrupts(vcpu);
                __vcpu_run(vcpu);
                rc = kvm_handle_sie_intercept(vcpu);
        } while (!signal_pending(current) && !rc);