Skip to content

Commit 8474e5c

Browse files
committed
KVM: s390: count invalid yields
To analyze some performance issues with lock contention and scheduling it is nice to know when diag9c did not result in any action or when no action was tried. Signed-off-by: Christian Borntraeger <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Cornelia Huck <[email protected]>
1 parent efec8d2 commit 8474e5c

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ struct kvm_vcpu_stat {
392392
u64 diagnose_10;
393393
u64 diagnose_44;
394394
u64 diagnose_9c;
395+
u64 diagnose_9c_ignored;
395396
u64 diagnose_258;
396397
u64 diagnose_308;
397398
u64 diagnose_500;

arch/s390/kvm/diag.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,24 @@ static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
158158

159159
tid = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
160160
vcpu->stat.diagnose_9c++;
161-
VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d", tid);
162161

162+
/* yield to self */
163163
if (tid == vcpu->vcpu_id)
164-
return 0;
164+
goto no_yield;
165165

166+
/* yield to invalid */
166167
tcpu = kvm_get_vcpu_by_id(vcpu->kvm, tid);
167-
if (tcpu)
168-
kvm_vcpu_yield_to(tcpu);
168+
if (!tcpu)
169+
goto no_yield;
170+
171+
if (kvm_vcpu_yield_to(tcpu) <= 0)
172+
goto no_yield;
173+
174+
VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d: done", tid);
175+
return 0;
176+
no_yield:
177+
VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d: ignored", tid);
178+
vcpu->stat.diagnose_9c_ignored++;
169179
return 0;
170180
}
171181

arch/s390/kvm/kvm-s390.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
155155
{ "instruction_diag_10", VCPU_STAT(diagnose_10) },
156156
{ "instruction_diag_44", VCPU_STAT(diagnose_44) },
157157
{ "instruction_diag_9c", VCPU_STAT(diagnose_9c) },
158+
{ "diag_9c_ignored", VCPU_STAT(diagnose_9c_ignored) },
158159
{ "instruction_diag_258", VCPU_STAT(diagnose_258) },
159160
{ "instruction_diag_308", VCPU_STAT(diagnose_308) },
160161
{ "instruction_diag_500", VCPU_STAT(diagnose_500) },

0 commit comments

Comments
 (0)