From 919b362849163d4c88e0dab3121f2f3c9d23fee2 Mon Sep 17 00:00:00 2001 From: simonb Date: Sat, 25 Oct 2003 15:52:38 +0000 Subject: [PATCH] Switch from intrcnt interrupt account to event counters. --- sys/arch/sbmips/include/intr.h | 7 +------ sys/arch/sbmips/sbmips/locore_machdep.S | 6 +----- sys/arch/sbmips/sbmips/sb1250_icu.c | 23 ++++++++++++++++------- sys/arch/sbmips/sbmips/softintr.c | 19 ++++++++++++++----- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/sys/arch/sbmips/include/intr.h b/sys/arch/sbmips/include/intr.h index 2da3d9818ac7..e66fee3236cd 100644 --- a/sys/arch/sbmips/include/intr.h +++ b/sys/arch/sbmips/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.2 2003/02/07 17:46:12 cgd Exp $ */ +/* $NetBSD: intr.h,v 1.3 2003/10/25 15:52:38 simonb Exp $ */ /* * Copyright 2000, 2001 @@ -95,9 +95,4 @@ extern void _splnone(void); extern void _setsoftintr(int); extern void _clrsoftintr(int); -/* XXX */ -extern u_long intrcnt[]; -#define SOFTCLOCK_INTR 0 -#define SOFTNET_INTR 1 - #endif /* _SBMIPS_INTR_H_ */ diff --git a/sys/arch/sbmips/sbmips/locore_machdep.S b/sys/arch/sbmips/sbmips/locore_machdep.S index 005c6badb88e..c05b06d9267a 100644 --- a/sys/arch/sbmips/sbmips/locore_machdep.S +++ b/sys/arch/sbmips/sbmips/locore_machdep.S @@ -1,4 +1,4 @@ -/* $NetBSD: locore_machdep.S,v 1.1 2002/03/06 02:13:51 simonb Exp $ */ +/* $NetBSD: locore_machdep.S,v 1.2 2003/10/25 15:52:38 simonb Exp $ */ #include @@ -9,12 +9,8 @@ .globl _C_LABEL(eintrnames) _C_LABEL(intrnames): - .asciiz "softclock" - .asciiz "softnet" _C_LABEL(eintrnames): .align 2 _C_LABEL(intrcnt): - .word 0,0 _C_LABEL(eintrcnt): - .word 0 diff --git a/sys/arch/sbmips/sbmips/sb1250_icu.c b/sys/arch/sbmips/sbmips/sb1250_icu.c index 7b8369a886a0..95ba0b0f7fcb 100644 --- a/sys/arch/sbmips/sbmips/sb1250_icu.c +++ b/sys/arch/sbmips/sbmips/sb1250_icu.c @@ -1,4 +1,4 @@ -/* $NetBSD: sb1250_icu.c,v 1.5 2003/09/26 10:34:41 simonb Exp $ */ +/* $NetBSD: sb1250_icu.c,v 1.6 2003/10/25 15:52:38 simonb Exp $ */ /* * Copyright 2000, 2001 @@ -33,10 +33,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.5 2003/09/26 10:34:41 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sb1250_icu.c,v 1.6 2003/10/25 15:52:38 simonb Exp $"); #include #include +#include +#include /* XXX for uvmexp */ #include @@ -54,6 +56,7 @@ struct sb1250_ihand { void (*fun)(void *, uint32_t, uint32_t); void *arg; int level; + struct evcnt count; }; static struct sb1250_ihand sb1250_ihands[64]; /* XXX */ @@ -69,9 +72,6 @@ static struct sb1250_ihand sb1250_ihands[64]; /* XXX */ #define READ_REG(rp) (mips3_ld((uint64_t *)(rp))) #define WRITE_REG(rp, val) (mips3_sd((uint64_t *)(rp), (val))) -#undef __inline -#define __inline - static void sb1250_cpu_intr(uint32_t, uint32_t, uint32_t, uint32_t); static void sb1250_cpu_setsoftintr(void); static void *sb1250_intr_establish(u_int, u_int, @@ -81,6 +81,7 @@ void sb1250_icu_init(void) { int i; + char *name; /* zero out the list of used interrupts/lines */ memset(ints_for_line, 0, sizeof ints_for_line); @@ -93,8 +94,14 @@ sb1250_icu_init(void) WRITE_REG(SB1250_I_IMR_ADDR, imr_all); - for (i = 0; i < 64; i++) + for (i = 0; i < 64; i++) { WRITE_REG(SB1250_I_MAP(i), SB1250_I_MAP_I0); + /* XXX add irq name arrays for various CPU models? */ + name = malloc(8, M_DEVBUF, M_NOWAIT); + snprintf(name, 8, "irq %d", i); + evcnt_attach_dynamic(&sb1250_ihands[i].count, EVCNT_TYPE_INTR, + NULL, "sb1250", name); /* XXX "sb1250"? */ + } } static void @@ -122,9 +129,11 @@ sb1250_cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending) sstatus &= ints_for_line[i]; for (j = 0; sstatus != 0 && j < 64; j++) { if (sstatus & ((uint64_t)1 << j)) { - struct sb1250_ihand *ihp = &sb1250_ihands[j]; + struct sb1250_ihand *ihp = + &sb1250_ihands[j]; (*ihp->fun)(ihp->arg, status, pc); sstatus &= ~((uint64_t)1 << j); + ihp->count.ev_count++; } } } diff --git a/sys/arch/sbmips/sbmips/softintr.c b/sys/arch/sbmips/sbmips/softintr.c index 4b1a2d92572b..e1e9874139e9 100644 --- a/sys/arch/sbmips/sbmips/softintr.c +++ b/sys/arch/sbmips/sbmips/softintr.c @@ -1,4 +1,4 @@ -/* $NetBSD: softintr.c,v 1.3 2003/02/07 17:46:12 cgd Exp $ */ +/* $NetBSD: softintr.c,v 1.4 2003/10/25 15:52:38 simonb Exp $ */ /* * Copyright 2000, 2001 @@ -34,11 +34,12 @@ #include -__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.3 2003/02/07 17:46:12 cgd Exp $"); +__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.4 2003/10/25 15:52:38 simonb Exp $"); #include -#include +#include #include +#include /* XXX for uvmexp */ #include @@ -60,6 +61,14 @@ static struct sh **sh_list_tail = &sh_list_head; static void dosoftnet(void *unused); static void dosoftclock(void *unused); +static struct evcnt softclock_ev = + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "soft", "clock"); +static struct evcnt softnet_ev = + EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "soft", "net"); + +EVCNT_ATTACH_STATIC(softclock_ev); +EVCNT_ATTACH_STATIC(softnet_ev); + void * softintr_establish(int level, void (*fun)(void *), void *arg) { @@ -150,7 +159,7 @@ static void dosoftclock(void *unused) { - intrcnt[SOFTCLOCK_INTR]++; + softclock_ev.ev_count++; softclock(NULL); } @@ -188,7 +197,7 @@ dosoftnet(void *unused) { int n, s; - intrcnt[SOFTNET_INTR]++; + softnet_ev.ev_count++; /* XXX could just use netintr! */