diff --git a/sys/arch/aarch64/include/cpu.h b/sys/arch/aarch64/include/cpu.h index e63714522413..faaa24544798 100644 --- a/sys/arch/aarch64/include/cpu.h +++ b/sys/arch/aarch64/include/cpu.h @@ -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; diff --git a/sys/arch/arm/cortex/gicv3.c b/sys/arch/arm/cortex/gicv3.c index f6ebf8ee5333..2930027898d9 100644 --- a/sys/arch/arm/cortex/gicv3.c +++ b/sys/arch/arm/cortex/gicv3.c @@ -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 @@ -31,7 +31,7 @@ #define _INTR_PRIVATE #include -__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 #include @@ -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();