Switch from intrcnt interrupt account to event counters.

This commit is contained in:
simonb 2003-10-25 15:52:38 +00:00
parent 49a8cd4e3a
commit 919b362849
4 changed files with 32 additions and 23 deletions

View File

@ -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_ */

View File

@ -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 <mips/asm.h>
@ -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

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
/* XXX for uvmexp */
#include <uvm/uvm_extern.h>
@ -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++;
}
}
}

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/systm.h>
/* XXX for uvmexp */
#include <uvm/uvm_extern.h>
@ -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! */