diff options
| author | Paolo Bonzini <[email protected]> | 2019-12-22 13:18:15 +0100 |
|---|---|---|
| committer | Paolo Bonzini <[email protected]> | 2019-12-22 13:18:15 +0100 |
| commit | d68321dec1b2234fb32f423e32c3af5915eae36c (patch) | |
| tree | 7c62b2c76d62ab607238bc2cccc24eed0b32687a /arch/s390/kvm/diag.c | |
| parent | 19a049f1a44d18e38a311e723c19c33c81020a30 (diff) | |
| parent | d89c69f42bf0fe42d1f52ea9b3dca15b1ade7601 (diff) | |
Merge tag 'kvm-ppc-fixes-5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into kvm-master
PPC KVM fix for 5.5
- Fix a bug where we try to do an ultracall on a system without an
ultravisor.
Diffstat (limited to 'arch/s390/kvm/diag.c')
| -rw-r--r-- | arch/s390/kvm/diag.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c index 45634b3d2e0a..3fb54ec2cf3e 100644 --- a/arch/s390/kvm/diag.c +++ b/arch/s390/kvm/diag.c @@ -158,14 +158,28 @@ 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; + + /* target already running */ + if (READ_ONCE(tcpu->cpu) >= 0) + 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; } |