Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: PPC: Book3S HV: Add ICP real mode counters

Add two counters to count how often we generate real-mode ICS resend
and reject events. The counters provide some performance statistics
that could be used in the future to consider if the real mode functions
need further optimizing. The counters are displayed as part of IPC and
ICP state provided by /sys/debug/kernel/powerpc/kvm* for each VM.

Also added two counters that count (approximately) how many times we
don't find an ICP or ICS we're looking for. These are not currently
exposed through sysfs, but can be useful when debugging crashes.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>

authored by

Suresh Warrier and committed by
Alexander Graf
6e0365b7 b0221556

+20 -2
+7
arch/powerpc/kvm/book3s_hv_rm_xics.c
··· 227 227 ics = kvmppc_xics_find_ics(xics, new_irq, &src); 228 228 if (!ics) { 229 229 /* Unsafe increment, but this does not need to be accurate */ 230 + xics->err_noics++; 230 231 return; 231 232 } 232 233 state = &ics->irq_state[src]; ··· 240 239 icp = kvmppc_xics_find_server(xics->kvm, state->server); 241 240 if (!icp) { 242 241 /* Unsafe increment again*/ 242 + xics->err_noicp++; 243 243 goto out; 244 244 } 245 245 } ··· 385 383 * separately here as well. 386 384 */ 387 385 if (resend) { 386 + icp->n_check_resend++; 388 387 icp_rm_check_resend(xics, icp); 389 388 } 390 389 } ··· 503 500 504 501 /* Handle reject in real mode */ 505 502 if (reject && reject != XICS_IPI) { 503 + this_icp->n_reject++; 506 504 icp_rm_deliver_irq(xics, icp, reject); 507 505 } 508 506 509 507 /* Handle resends in real mode */ 510 508 if (resend) { 509 + this_icp->n_check_resend++; 511 510 icp_rm_check_resend(xics, icp); 512 511 } 513 512 ··· 571 566 * attempt (see comments in icp_rm_deliver_irq). 572 567 */ 573 568 if (reject && reject != XICS_IPI) { 569 + icp->n_reject++; 574 570 icp_rm_deliver_irq(xics, icp, reject); 575 571 } 576 572 bail: ··· 622 616 623 617 /* Still asserted, resend it */ 624 618 if (state->asserted) { 619 + icp->n_reject++; 625 620 icp_rm_deliver_irq(xics, icp, irq); 626 621 } 627 622
+8 -2
arch/powerpc/kvm/book3s_xics.c
··· 901 901 unsigned long flags; 902 902 unsigned long t_rm_kick_vcpu, t_rm_check_resend; 903 903 unsigned long t_rm_reject, t_rm_notify_eoi; 904 + unsigned long t_reject, t_check_resend; 904 905 905 906 if (!kvm) 906 907 return 0; ··· 910 909 t_rm_notify_eoi = 0; 911 910 t_rm_check_resend = 0; 912 911 t_rm_reject = 0; 912 + t_check_resend = 0; 913 + t_reject = 0; 913 914 914 915 seq_printf(m, "=========\nICP state\n=========\n"); 915 916 ··· 931 928 t_rm_notify_eoi += icp->n_rm_notify_eoi; 932 929 t_rm_check_resend += icp->n_rm_check_resend; 933 930 t_rm_reject += icp->n_rm_reject; 931 + t_check_resend += icp->n_check_resend; 932 + t_reject += icp->n_reject; 934 933 } 935 934 936 - seq_puts(m, "ICP Guest Real Mode exit totals: "); 937 - seq_printf(m, "\tkick_vcpu=%lu check_resend=%lu reject=%lu notify_eoi=%lu\n", 935 + seq_printf(m, "ICP Guest->Host totals: kick_vcpu=%lu check_resend=%lu reject=%lu notify_eoi=%lu\n", 938 936 t_rm_kick_vcpu, t_rm_check_resend, 939 937 t_rm_reject, t_rm_notify_eoi); 938 + seq_printf(m, "ICP Real Mode totals: check_resend=%lu resend=%lu\n", 939 + t_check_resend, t_reject); 940 940 for (icsid = 0; icsid <= KVMPPC_XICS_MAX_ICS_ID; icsid++) { 941 941 struct kvmppc_ics *ics = xics->ics[icsid]; 942 942
+5
arch/powerpc/kvm/book3s_xics.h
··· 83 83 unsigned long n_rm_check_resend; 84 84 unsigned long n_rm_reject; 85 85 unsigned long n_rm_notify_eoi; 86 + /* Counters for handling ICP processing in real mode */ 87 + unsigned long n_check_resend; 88 + unsigned long n_reject; 86 89 87 90 /* Debug stuff for real mode */ 88 91 union kvmppc_icp_state rm_dbgstate; ··· 105 102 u32 max_icsid; 106 103 bool real_mode; 107 104 bool real_mode_dbg; 105 + u32 err_noics; 106 + u32 err_noicp; 108 107 struct kvmppc_ics *ics[KVMPPC_XICS_MAX_ICS_ID + 1]; 109 108 }; 110 109