KVM: s390: fast path for sca_ext_call_pending
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Wed, 23 Sep 2015 07:45:50 +0000 (09:45 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 30 Nov 2015 11:47:09 +0000 (12:47 +0100)
If CPUSTAT_ECALL_PEND isn't set, we can't have an external call pending,
so we can directly avoid taking the lock.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/interrupt.c

index 831c9ac728ec0956ca9f9054458c483e07eb62fd..62ec925aa196d061d2fd7acc35d6542d6d5c188c 100644 (file)
@@ -39,6 +39,9 @@ static int sca_ext_call_pending(struct kvm_vcpu *vcpu, int *src_id)
 {
        int c, scn;
 
+       if (!(atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_ECALL_PEND))
+               return 0;
+
        read_lock(&vcpu->kvm->arch.sca_lock);
        if (vcpu->kvm->arch.use_esca) {
                struct esca_block *sca = vcpu->kvm->arch.sca;
@@ -60,8 +63,7 @@ static int sca_ext_call_pending(struct kvm_vcpu *vcpu, int *src_id)
        if (src_id)
                *src_id = scn;
 
-       return c && atomic_read(&vcpu->arch.sie_block->cpuflags) &
-                       CPUSTAT_ECALL_PEND;
+       return c;
 }
 
 static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id)