Switch to using evcnt(9) to track interrupt counts.

This commit is contained in:
simonb 2002-11-22 13:26:39 +00:00
parent 11823a584d
commit fe72c084d6
5 changed files with 30 additions and 52 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: scn.c,v 1.58 2002/11/21 00:23:24 simonb Exp $ */ /* $NetBSD: scn.c,v 1.59 2002/11/22 13:26:39 simonb Exp $ */
/* /*
* Copyright (c) 1996, 1997 Philip L. Budne. * Copyright (c) 1996, 1997 Philip L. Budne.
@ -790,6 +790,7 @@ scnattach(parent, self, aux)
u_char delim = ':'; u_char delim = ':';
enum scntype scntype = SCNUNK; enum scntype scntype = SCNUNK;
char *duart_type = "Unknown"; char *duart_type = "Unknown";
char *intrname;
sc = (void *) self; sc = (void *) self;
unit = self->dv_unit; /* sc->sc_dev.dv_unit ??? */ unit = self->dv_unit; /* sc->sc_dev.dv_unit ??? */
@ -882,8 +883,10 @@ scnattach(parent, self, aux)
splx(s); splx(s);
/* Arg 0 is special, so we must pass "unit + 1" */ /* Arg 0 is special, so we must pass "unit + 1" */
intrname = malloc(sizeof("scnXX"), M_DEVBUF, M_NOWAIT);
snprintf(intrname, sizeof("scnXX"), "scn%d", unit);
intr_establish(scnints[duart], scnintr, (void *) (unit + 1), intr_establish(scnints[duart], scnintr, (void *) (unit + 1),
"scn", IPL_TTY, IPL_ZERO, LOW_LEVEL); intrname, IPL_TTY, IPL_ZERO, LOW_LEVEL);
printf("%c %s", delim, duart_type); printf("%c %s", delim, duart_type);
delim = ','; delim = ',';
@ -892,8 +895,10 @@ scnattach(parent, self, aux)
* IPL_ZERO is the right priority for the rx interrupt. * IPL_ZERO is the right priority for the rx interrupt.
* Only splhigh() should disable rxints. * Only splhigh() should disable rxints.
*/ */
intrname = malloc(sizeof("scnXXrx"), M_DEVBUF, M_NOWAIT);
snprintf(intrname, 8, "scn%drx", unit);
intr_establish(rxints[duart], scnrxintr, (void *) (unit + 1), intr_establish(rxints[duart], scnrxintr, (void *) (unit + 1),
"scnrx", IPL_ZERO, IPL_RTTY, LOW_LEVEL); intrname, IPL_ZERO, IPL_RTTY, LOW_LEVEL);
} }
/* Record unit number, uart */ /* Record unit number, uart */
sc->sc_unit = unit; sc->sc_unit = unit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.1 2002/05/25 04:27:21 simonb Exp $ */ /* $NetBSD: intr.h,v 1.2 2002/11/22 13:26:40 simonb Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -73,6 +73,8 @@
#define SIR_ALLMASK 0xffff0000 #define SIR_ALLMASK 0xffff0000
#ifndef _LOCORE #ifndef _LOCORE
#include <sys/device.h>
/* /*
* Structure of the software interrupt table * Structure of the software interrupt table
*/ */
@ -81,7 +83,7 @@ struct iv {
void *iv_arg; void *iv_arg;
long iv_level; long iv_level;
long iv_mask; long iv_mask;
long iv_cnt; struct evcnt iv_evcnt;
char *iv_use; char *iv_use;
}; };

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.9 2002/07/09 23:10:03 simonb Exp $ # $NetBSD: genassym.cf,v 1.10 2002/11/22 13:26:40 simonb Exp $
# #
# Copyright (c) 1982, 1990 The Regents of the University of California. # Copyright (c) 1982, 1990 The Regents of the University of California.
@ -48,6 +48,7 @@ include <sys/user.h>
include <uvm/uvm_extern.h> include <uvm/uvm_extern.h>
include <machine/intr.h>
include <machine/trap.h> include <machine/trap.h>
include <machine/pmap.h> include <machine/pmap.h>
include <machine/vmparam.h> include <machine/vmparam.h>
@ -100,7 +101,9 @@ define REGS_PSR offsetof(struct reg, r_psr)
define IV_VEC offsetof(struct iv, iv_vec) define IV_VEC offsetof(struct iv, iv_vec)
define IV_ARG offsetof(struct iv, iv_arg) define IV_ARG offsetof(struct iv, iv_arg)
define IV_CNT offsetof(struct iv, iv_cnt)
define IV_USE offsetof(struct iv, iv_use) define IV_USE offsetof(struct iv, iv_use)
define IV_MASK offsetof(struct iv, iv_mask) define IV_MASK offsetof(struct iv, iv_mask)
define IV_EVCNT offsetof(struct iv, iv_evcnt)
define IV_SIZE sizeof(struct iv) define IV_SIZE sizeof(struct iv)
define EV_COUNT offsetof(struct evcnt, ev_count)

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.25 2002/09/27 15:36:33 provos Exp $ */ /* $NetBSD: intr.c,v 1.26 2002/11/22 13:26:41 simonb Exp $ */
/* /*
* Copyright (c) 1994 Matthias Pfaller. * Copyright (c) 1994 Matthias Pfaller.
@ -33,6 +33,7 @@
#define DEFINE_SPLX #define DEFINE_SPLX
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/device.h>
#include <uvm/uvm_extern.h> #include <uvm/uvm_extern.h>
@ -131,7 +132,7 @@ check_sir(arg)
if ((cirpending & mask) != 0) { if ((cirpending & mask) != 0) {
register int s; register int s;
uvmexp.softs++; uvmexp.softs++;
iv->iv_cnt++; iv->iv_evcnt.ev_count++;
s = splraise(iv->iv_mask); s = splraise(iv->iv_mask);
iv->iv_vec(iv->iv_arg); iv->iv_vec(iv->iv_arg);
splx(s); splx(s);
@ -159,9 +160,10 @@ intr_establish(intr, vector, arg, use, blevel, rlevel, mode)
int rlevel; int rlevel;
int mode; int mode;
{ {
int i; int i, soft;
di(); di();
soft = intr == SOFTINT;
if (rlevel < IPL_ZERO || rlevel >= NIPL || if (rlevel < IPL_ZERO || rlevel >= NIPL ||
blevel < IPL_ZERO || blevel >= NIPL) blevel < IPL_ZERO || blevel >= NIPL)
panic("Illegal interrupt level for %s in intr_establish", use); panic("Illegal interrupt level for %s in intr_establish", use);
@ -195,9 +197,10 @@ intr_establish(intr, vector, arg, use, blevel, rlevel, mode)
} }
ivt[intr].iv_vec = vector; ivt[intr].iv_vec = vector;
ivt[intr].iv_arg = arg; ivt[intr].iv_arg = arg;
ivt[intr].iv_cnt = 0;
ivt[intr].iv_use = use; ivt[intr].iv_use = use;
ivt[intr].iv_level = rlevel; ivt[intr].iv_level = rlevel;
evcnt_attach_dynamic(&ivt[intr].iv_evcnt, EVCNT_TYPE_INTR, NULL,
soft ? "soft" : "intr", use);
ei(); ei();
imask[blevel] |= 1 << intr; imask[blevel] |= 1 << intr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.67 2002/07/11 00:41:50 simonb Exp $ */ /* $NetBSD: locore.s,v 1.68 2002/11/22 13:26:41 simonb Exp $ */
/* /*
* Copyright (c) 1993 Philip A. Nelson. * Copyright (c) 1993 Philip A. Nelson.
@ -1119,7 +1119,8 @@ ASENTRY_NOPROFILE(interrupt)
*/ */
addqd 1,_C_LABEL(intrcnt)(pc)[r1:d] addqd 1,_C_LABEL(intrcnt)(pc)[r1:d]
addqd 1,_C_LABEL(uvmexp)+V_INTR(pc) addqd 1,_C_LABEL(uvmexp)+V_INTR(pc)
addqd 1,_C_LABEL(ivt)+IV_CNT(r0) addqd 1,_C_LABEL(ivt)+(IV_EVCNT+EV_COUNT)(r0)
addcd 0,_C_LABEL(ivt)+(IV_EVCNT+EV_COUNT+4)(r0)
movd _C_LABEL(ivt)+IV_ARG(r0),r1 /* Get argument */ movd _C_LABEL(ivt)+IV_ARG(r0),r1 /* Get argument */
cmpqd 0,r1 cmpqd 0,r1
@ -1284,46 +1285,10 @@ KENTRY(ram_size, 4)
/****************************************************************************/ /****************************************************************************/
/* /*
* vmstat -i uses the following labels and interrupt even increments the * XXX: Some bogus symbols to keep vmstat -i happy, for now.
* counters. This information is also availiable from ivt[n].iv_use
* and ivt[n].iv_cnt in much better form.
*/ */
.text
GLOBAL(intrnames)
ASMSTR "int 0"
ASMSTR "int 1"
ASMSTR "int 2"
ASMSTR "int 3"
ASMSTR "int 4"
ASMSTR "int 5"
ASMSTR "int 6"
ASMSTR "int 7"
ASMSTR "int 8"
ASMSTR "int 9"
ASMSTR "int 10"
ASMSTR "int 11"
ASMSTR "int 12"
ASMSTR "int 13"
ASMSTR "int 14"
ASMSTR "int 15"
GLOBAL(eintrnames)
.data .data
GLOBAL(intrnames)
GLOBAL(eintrnames)
GLOBAL(intrcnt) GLOBAL(intrcnt)
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
GLOBAL(eintrcnt) GLOBAL(eintrcnt)