summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2018-01-23 07:28:40 -0500
committerChristian Borntraeger <borntraeger@de.ibm.com>2018-01-24 10:49:02 -0500
commita37cb07a30f0a181bc45c6970e486ac2992e9cde (patch)
tree6f8d5fac8d50742efba135d72b6ac2b9811220f5 /arch
parent866c138c32547b690e4cab3cd209c763508a95ab (diff)
KVM: s390: add vcpu stat counters for many instruction
The overall instruction counter is larger than the sum of the single counters. We should try to catch all instruction handlers to make this match the summary counter. Let us add sck,tb,sske,iske,rrbe,tb,tpi,tsch,lpsw,pswe.... and remove other unused ones. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/kvm_host.h21
-rw-r--r--arch/s390/kvm/diag.c1
-rw-r--r--arch/s390/kvm/kvm-s390.c21
-rw-r--r--arch/s390/kvm/priv.c32
4 files changed, 65 insertions, 10 deletions
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index e16a9f2a44ad..029e8144c6ec 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -2,7 +2,7 @@
2/* 2/*
3 * definition for kernel virtual machines on s390 3 * definition for kernel virtual machines on s390
4 * 4 *
5 * Copyright IBM Corp. 2008, 2009 5 * Copyright IBM Corp. 2008, 2018
6 * 6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 */ 8 */
@@ -316,18 +316,30 @@ struct kvm_vcpu_stat {
316 u64 deliver_program_int; 316 u64 deliver_program_int;
317 u64 deliver_io_int; 317 u64 deliver_io_int;
318 u64 exit_wait_state; 318 u64 exit_wait_state;
319 u64 instruction_epsw;
320 u64 instruction_gs;
321 u64 instruction_io_other;
322 u64 instruction_lpsw;
323 u64 instruction_lpswe;
319 u64 instruction_pfmf; 324 u64 instruction_pfmf;
325 u64 instruction_ptff;
326 u64 instruction_sck;
327 u64 instruction_sckpf;
320 u64 instruction_stidp; 328 u64 instruction_stidp;
321 u64 instruction_spx; 329 u64 instruction_spx;
322 u64 instruction_stpx; 330 u64 instruction_stpx;
323 u64 instruction_stap; 331 u64 instruction_stap;
324 u64 instruction_storage_key; 332 u64 instruction_iske;
333 u64 instruction_ri;
334 u64 instruction_rrbe;
335 u64 instruction_sske;
325 u64 instruction_ipte_interlock; 336 u64 instruction_ipte_interlock;
326 u64 instruction_stsch;
327 u64 instruction_chsc;
328 u64 instruction_stsi; 337 u64 instruction_stsi;
329 u64 instruction_stfl; 338 u64 instruction_stfl;
339 u64 instruction_tb;
340 u64 instruction_tpi;
330 u64 instruction_tprot; 341 u64 instruction_tprot;
342 u64 instruction_tsch;
331 u64 instruction_sie; 343 u64 instruction_sie;
332 u64 instruction_essa; 344 u64 instruction_essa;
333 u64 instruction_sthyi; 345 u64 instruction_sthyi;
@@ -353,6 +365,7 @@ struct kvm_vcpu_stat {
353 u64 diagnose_258; 365 u64 diagnose_258;
354 u64 diagnose_308; 366 u64 diagnose_308;
355 u64 diagnose_500; 367 u64 diagnose_500;
368 u64 diagnose_other;
356}; 369};
357 370
358#define PGM_OPERATION 0x01 371#define PGM_OPERATION 0x01
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 89aa114a2cba..45634b3d2e0a 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -257,6 +257,7 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
257 case 0x500: 257 case 0x500:
258 return __diag_virtio_hypercall(vcpu); 258 return __diag_virtio_hypercall(vcpu);
259 default: 259 default:
260 vcpu->stat.diagnose_other++;
260 return -EOPNOTSUPP; 261 return -EOPNOTSUPP;
261 } 262 }
262} 263}
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ce8ea8b94478..8a3a1d50ef99 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * hosting IBM Z kernel virtual machines (s390x) 3 * hosting IBM Z kernel virtual machines (s390x)
4 * 4 *
5 * Copyright IBM Corp. 2008, 2017 5 * Copyright IBM Corp. 2008, 2018
6 * 6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
@@ -87,19 +87,31 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
87 { "deliver_restart_signal", VCPU_STAT(deliver_restart_signal) }, 87 { "deliver_restart_signal", VCPU_STAT(deliver_restart_signal) },
88 { "deliver_program_interruption", VCPU_STAT(deliver_program_int) }, 88 { "deliver_program_interruption", VCPU_STAT(deliver_program_int) },
89 { "exit_wait_state", VCPU_STAT(exit_wait_state) }, 89 { "exit_wait_state", VCPU_STAT(exit_wait_state) },
90 { "instruction_epsw", VCPU_STAT(instruction_epsw) },
91 { "instruction_gs", VCPU_STAT(instruction_gs) },
92 { "instruction_io_other", VCPU_STAT(instruction_io_other) },
93 { "instruction_lpsw", VCPU_STAT(instruction_lpsw) },
94 { "instruction_lpswe", VCPU_STAT(instruction_lpswe) },
90 { "instruction_pfmf", VCPU_STAT(instruction_pfmf) }, 95 { "instruction_pfmf", VCPU_STAT(instruction_pfmf) },
96 { "instruction_ptff", VCPU_STAT(instruction_ptff) },
91 { "instruction_stidp", VCPU_STAT(instruction_stidp) }, 97 { "instruction_stidp", VCPU_STAT(instruction_stidp) },
98 { "instruction_sck", VCPU_STAT(instruction_sck) },
99 { "instruction_sckpf", VCPU_STAT(instruction_sckpf) },
92 { "instruction_spx", VCPU_STAT(instruction_spx) }, 100 { "instruction_spx", VCPU_STAT(instruction_spx) },
93 { "instruction_stpx", VCPU_STAT(instruction_stpx) }, 101 { "instruction_stpx", VCPU_STAT(instruction_stpx) },
94 { "instruction_stap", VCPU_STAT(instruction_stap) }, 102 { "instruction_stap", VCPU_STAT(instruction_stap) },
95 { "instruction_storage_key", VCPU_STAT(instruction_storage_key) }, 103 { "instruction_iske", VCPU_STAT(instruction_iske) },
104 { "instruction_ri", VCPU_STAT(instruction_ri) },
105 { "instruction_rrbe", VCPU_STAT(instruction_rrbe) },
106 { "instruction_sske", VCPU_STAT(instruction_sske) },
96 { "instruction_ipte_interlock", VCPU_STAT(instruction_ipte_interlock) }, 107 { "instruction_ipte_interlock", VCPU_STAT(instruction_ipte_interlock) },
97 { "instruction_stsch", VCPU_STAT(instruction_stsch) },
98 { "instruction_chsc", VCPU_STAT(instruction_chsc) },
99 { "instruction_essa", VCPU_STAT(instruction_essa) }, 108 { "instruction_essa", VCPU_STAT(instruction_essa) },
100 { "instruction_stsi", VCPU_STAT(instruction_stsi) }, 109 { "instruction_stsi", VCPU_STAT(instruction_stsi) },
101 { "instruction_stfl", VCPU_STAT(instruction_stfl) }, 110 { "instruction_stfl", VCPU_STAT(instruction_stfl) },
111 { "instruction_tb", VCPU_STAT(instruction_tb) },
112 { "instruction_tpi", VCPU_STAT(instruction_tpi) },
102 { "instruction_tprot", VCPU_STAT(instruction_tprot) }, 113 { "instruction_tprot", VCPU_STAT(instruction_tprot) },
114 { "instruction_tsch", VCPU_STAT(instruction_tsch) },
103 { "instruction_sthyi", VCPU_STAT(instruction_sthyi) }, 115 { "instruction_sthyi", VCPU_STAT(instruction_sthyi) },
104 { "instruction_sie", VCPU_STAT(instruction_sie) }, 116 { "instruction_sie", VCPU_STAT(instruction_sie) },
105 { "instruction_sigp_sense", VCPU_STAT(instruction_sigp_sense) }, 117 { "instruction_sigp_sense", VCPU_STAT(instruction_sigp_sense) },
@@ -124,6 +136,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
124 { "instruction_diag_258", VCPU_STAT(diagnose_258) }, 136 { "instruction_diag_258", VCPU_STAT(diagnose_258) },
125 { "instruction_diag_308", VCPU_STAT(diagnose_308) }, 137 { "instruction_diag_308", VCPU_STAT(diagnose_308) },
126 { "instruction_diag_500", VCPU_STAT(diagnose_500) }, 138 { "instruction_diag_500", VCPU_STAT(diagnose_500) },
139 { "instruction_diag_other", VCPU_STAT(diagnose_other) },
127 { NULL } 140 { NULL }
128}; 141};
129 142
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 572496c688cc..dea0217922d6 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * handling privileged instructions 3 * handling privileged instructions
4 * 4 *
5 * Copyright IBM Corp. 2008, 2013 5 * Copyright IBM Corp. 2008, 2018
6 * 6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
@@ -34,6 +34,8 @@
34 34
35static int handle_ri(struct kvm_vcpu *vcpu) 35static int handle_ri(struct kvm_vcpu *vcpu)
36{ 36{
37 vcpu->stat.instruction_ri++;
38
37 if (test_kvm_facility(vcpu->kvm, 64)) { 39 if (test_kvm_facility(vcpu->kvm, 64)) {
38 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: RI (lazy)"); 40 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: RI (lazy)");
39 vcpu->arch.sie_block->ecb3 |= ECB3_RI; 41 vcpu->arch.sie_block->ecb3 |= ECB3_RI;
@@ -53,6 +55,8 @@ int kvm_s390_handle_aa(struct kvm_vcpu *vcpu)
53 55
54static int handle_gs(struct kvm_vcpu *vcpu) 56static int handle_gs(struct kvm_vcpu *vcpu)
55{ 57{
58 vcpu->stat.instruction_gs++;
59
56 if (test_kvm_facility(vcpu->kvm, 133)) { 60 if (test_kvm_facility(vcpu->kvm, 133)) {
57 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: GS (lazy)"); 61 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: GS (lazy)");
58 preempt_disable(); 62 preempt_disable();
@@ -85,6 +89,8 @@ static int handle_set_clock(struct kvm_vcpu *vcpu)
85 u8 ar; 89 u8 ar;
86 u64 op2, val; 90 u64 op2, val;
87 91
92 vcpu->stat.instruction_sck++;
93
88 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 94 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
89 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 95 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
90 96
@@ -222,7 +228,6 @@ static int try_handle_skey(struct kvm_vcpu *vcpu)
222{ 228{
223 int rc; 229 int rc;
224 230
225 vcpu->stat.instruction_storage_key++;
226 rc = kvm_s390_skey_check_enable(vcpu); 231 rc = kvm_s390_skey_check_enable(vcpu);
227 if (rc) 232 if (rc)
228 return rc; 233 return rc;
@@ -242,6 +247,8 @@ static int handle_iske(struct kvm_vcpu *vcpu)
242 int reg1, reg2; 247 int reg1, reg2;
243 int rc; 248 int rc;
244 249
250 vcpu->stat.instruction_iske++;
251
245 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 252 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
246 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 253 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
247 254
@@ -274,6 +281,8 @@ static int handle_rrbe(struct kvm_vcpu *vcpu)
274 int reg1, reg2; 281 int reg1, reg2;
275 int rc; 282 int rc;
276 283
284 vcpu->stat.instruction_rrbe++;
285
277 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 286 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
278 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 287 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
279 288
@@ -312,6 +321,8 @@ static int handle_sske(struct kvm_vcpu *vcpu)
312 int reg1, reg2; 321 int reg1, reg2;
313 int rc; 322 int rc;
314 323
324 vcpu->stat.instruction_sske++;
325
315 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 326 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
316 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 327 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
317 328
@@ -392,6 +403,8 @@ static int handle_test_block(struct kvm_vcpu *vcpu)
392 gpa_t addr; 403 gpa_t addr;
393 int reg2; 404 int reg2;
394 405
406 vcpu->stat.instruction_tb++;
407
395 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 408 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
396 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 409 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
397 410
@@ -424,6 +437,8 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
424 u64 addr; 437 u64 addr;
425 u8 ar; 438 u8 ar;
426 439
440 vcpu->stat.instruction_tpi++;
441
427 addr = kvm_s390_get_base_disp_s(vcpu, &ar); 442 addr = kvm_s390_get_base_disp_s(vcpu, &ar);
428 if (addr & 3) 443 if (addr & 3)
429 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 444 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
@@ -484,6 +499,8 @@ static int handle_tsch(struct kvm_vcpu *vcpu)
484 struct kvm_s390_interrupt_info *inti = NULL; 499 struct kvm_s390_interrupt_info *inti = NULL;
485 const u64 isc_mask = 0xffUL << 24; /* all iscs set */ 500 const u64 isc_mask = 0xffUL << 24; /* all iscs set */
486 501
502 vcpu->stat.instruction_tsch++;
503
487 /* a valid schid has at least one bit set */ 504 /* a valid schid has at least one bit set */
488 if (vcpu->run->s.regs.gprs[1]) 505 if (vcpu->run->s.regs.gprs[1])
489 inti = kvm_s390_get_io_int(vcpu->kvm, isc_mask, 506 inti = kvm_s390_get_io_int(vcpu->kvm, isc_mask,
@@ -527,6 +544,7 @@ static int handle_io_inst(struct kvm_vcpu *vcpu)
527 if (vcpu->arch.sie_block->ipa == 0xb235) 544 if (vcpu->arch.sie_block->ipa == 0xb235)
528 return handle_tsch(vcpu); 545 return handle_tsch(vcpu);
529 /* Handle in userspace. */ 546 /* Handle in userspace. */
547 vcpu->stat.instruction_io_other++;
530 return -EOPNOTSUPP; 548 return -EOPNOTSUPP;
531 } else { 549 } else {
532 /* 550 /*
@@ -592,6 +610,8 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
592 int rc; 610 int rc;
593 u8 ar; 611 u8 ar;
594 612
613 vcpu->stat.instruction_lpsw++;
614
595 if (gpsw->mask & PSW_MASK_PSTATE) 615 if (gpsw->mask & PSW_MASK_PSTATE)
596 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 616 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
597 617
@@ -619,6 +639,8 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
619 int rc; 639 int rc;
620 u8 ar; 640 u8 ar;
621 641
642 vcpu->stat.instruction_lpswe++;
643
622 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 644 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
623 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 645 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
624 646
@@ -828,6 +850,8 @@ static int handle_epsw(struct kvm_vcpu *vcpu)
828{ 850{
829 int reg1, reg2; 851 int reg1, reg2;
830 852
853 vcpu->stat.instruction_epsw++;
854
831 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2); 855 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
832 856
833 /* This basically extracts the mask half of the psw. */ 857 /* This basically extracts the mask half of the psw. */
@@ -1332,6 +1356,8 @@ static int handle_sckpf(struct kvm_vcpu *vcpu)
1332{ 1356{
1333 u32 value; 1357 u32 value;
1334 1358
1359 vcpu->stat.instruction_sckpf++;
1360
1335 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 1361 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1336 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 1362 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1337 1363
@@ -1347,6 +1373,8 @@ static int handle_sckpf(struct kvm_vcpu *vcpu)
1347 1373
1348static int handle_ptff(struct kvm_vcpu *vcpu) 1374static int handle_ptff(struct kvm_vcpu *vcpu)
1349{ 1375{
1376 vcpu->stat.instruction_ptff++;
1377
1350 /* we don't emulate any control instructions yet */ 1378 /* we don't emulate any control instructions yet */
1351 kvm_s390_set_psw_cc(vcpu, 3); 1379 kvm_s390_set_psw_cc(vcpu, 3);
1352 return 0; 1380 return 0;