KVM: s390: count invalid yields
[sfrench/cifs-2.6.git] / arch / s390 / kvm / diag.c
index 45634b3d2e0aedf90ece3f2c715e6ab9e53d9f00..609c55df3ce862be7a3884a90a27446a5e61d3f2 100644 (file)
@@ -158,14 +158,24 @@ static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
 
        tid = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
        vcpu->stat.diagnose_9c++;
-       VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d", tid);
 
+       /* yield to self */
        if (tid == vcpu->vcpu_id)
-               return 0;
+               goto no_yield;
 
+       /* yield to invalid */
        tcpu = kvm_get_vcpu_by_id(vcpu->kvm, tid);
-       if (tcpu)
-               kvm_vcpu_yield_to(tcpu);
+       if (!tcpu)
+               goto no_yield;
+
+       if (kvm_vcpu_yield_to(tcpu) <= 0)
+               goto no_yield;
+
+       VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d: done", tid);
+       return 0;
+no_yield:
+       VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d: ignored", tid);
+       vcpu->stat.diagnose_9c_ignored++;
        return 0;
 }