Add a per-CPU event counter that counts every time an interrupt handler is

preempted by a higher priority interrupt.
This commit is contained in:
jmcneill 2020-11-21 11:43:59 +00:00
parent 3eea9a90f9
commit d5776e5520
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.28 2020/10/01 06:40:16 ryo Exp $ */
/* $NetBSD: cpu.h,v 1.29 2020/11/21 11:43:59 jmcneill Exp $ */
/*-
* Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@ -112,6 +112,7 @@ struct cpu_info {
struct evcnt ci_vfp_save;
struct evcnt ci_vfp_release;
struct evcnt ci_uct_trap;
struct evcnt ci_intr_preempt;
/* FDT or similar supplied "cpu capacity" */
uint32_t ci_capacity_dmips_mhz;

View File

@ -1,4 +1,4 @@
/* $NetBSD: gicv3.c,v 1.32 2020/11/01 14:30:12 jmcneill Exp $ */
/* $NetBSD: gicv3.c,v 1.33 2020/11/21 11:44:00 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -31,7 +31,7 @@
#define _INTR_PRIVATE
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.32 2020/11/01 14:30:12 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.33 2020/11/21 11:44:00 jmcneill Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -368,6 +368,9 @@ gicv3_cpu_init(struct pic_softc *pic, struct cpu_info *ci)
struct gicv3_softc * const sc = PICTOSOFTC(pic);
uint32_t icc_sre, icc_ctlr, gicr_waker;
evcnt_attach_dynamic(&ci->ci_intr_preempt, EVCNT_TYPE_MISC, NULL,
ci->ci_cpuname, "intr preempt");
ci->ci_gic_redist = gicv3_find_redist(sc);
ci->ci_gic_sgir = gicv3_sgir(sc);
@ -734,10 +737,15 @@ gicv3_irq_handler(void *frame)
isb();
}
const int64_t nintr = ci->ci_data.cpu_nintr;
cpsie(I32_bit);
pic_dispatch(is, frame);
cpsid(I32_bit);
if (nintr != ci->ci_data.cpu_nintr)
ci->ci_intr_preempt.ev_count++;
if (!early_eoi) {
icc_eoi1r_write(iar);
isb();