Date: Sat, 28 Nov 1998 11:38:16 +0900 From: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp> To: dfr@nlsystems.com Cc: dima@best.net, freebsd-alpha@FreeBSD.ORG Subject: Re: vmstat -i Message-ID: <19981128113816T.simokawa@sat.t.u-tokyo.ac.jp> In-Reply-To: Your message of "Fri, 27 Nov 1998 21:17:32 %2B0000 (GMT)" <Pine.BSF.4.01.9811272112450.21711-100000@herring.nlsystems.com> References: <Pine.BSF.4.01.9811272112450.21711-100000@herring.nlsystems.com>
next in thread | previous in thread | raw e-mail | index | archive | help
dfr> I'm not too keen on this interrupt counting mechanism but it is at least dfr> simple. I would probably pass the address of a struct evcnt to dfr> alpha_setup_intr() instead of wrapping the handler with pci_handle_intr(). dfr> The generic code would handle incrementing the counter. I agree with you. struct alpha_intr should have pointer to intrcnt and alpha_dispatch_intr should increment it. How about this? Index: alpha/interrupt.c =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/alpha/alpha/interrupt.c,v retrieving revision 1.7 diff -u -r1.7 interrupt.c --- interrupt.c 1998/11/18 23:51:40 1.7 +++ interrupt.c 1998/11/28 02:35:02 @@ -50,14 +50,12 @@ #include <machine/bwx.h> #include <machine/intr.h> -#if 0 #ifdef EVCNT_COUNTERS #include <sys/device.h> struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */ #else #include <machine/intrcnt.h> #endif -#endif volatile int mc_expected, mc_received; @@ -84,13 +82,11 @@ case ALPHA_INTR_CLOCK: /* clock interrupt */ cnt.v_intr++; -#if 0 #ifdef EVCNT_COUNTERS clock_intr_evcnt.ev_count++; #else intrcnt[INTRCNT_CLOCK]++; #endif -#endif if (platform.clockintr) (*platform.clockintr)(framep); break; @@ -287,12 +283,13 @@ int vector; /* vector to match */ driver_intr_t *intr; /* handler function */ void *arg; /* argument to handler */ + volatile long *cntp; /* interrupt counter */ }; static struct alpha_intr_list alpha_intr_hash[31]; int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg, - void **cookiep) + void **cookiep, volatile long *cntp) { int h = HASHVEC(vector); struct alpha_intr *i; @@ -304,6 +301,10 @@ i->vector = vector; i->intr = intr; i->arg = arg; + if (cntp) + i->cntp = cntp; + else + i->cntp = NULL; s = splhigh(); LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list); @@ -331,8 +332,13 @@ alpha_dispatch_intr(void *frame, unsigned long vector) { struct alpha_intr *i; + volatile long *cntp; + int h = HASHVEC(vector); for (i = LIST_FIRST(&alpha_intr_hash[h]); i; i = LIST_NEXT(i, list)) - if (i->vector == vector) + if (i->vector == vector) { + if (cntp = i->cntp) + (*cntp) ++; i->intr(i->arg); + } } Index: alpha/locore.s =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/alpha/alpha/locore.s,v retrieving revision 1.5 diff -u -r1.5 locore.s --- locore.s 1998/11/15 00:50:59 1.5 +++ locore.s 1998/11/25 14:07:36 @@ -56,6 +56,11 @@ #include <sys/syscall.h> #include <assym.s> +#ifndef EVCNT_COUNTERS +#define _LOCORE +#include <machine/intrcnt.h> +#endif + /* * PTmap is recursive pagemap at top of virtual address space. * Within PTmap, the lev1 and lev0 page tables can be found. @@ -296,10 +301,14 @@ /* XXX: make systat/vmstat happy */ .data EXPORT(intrnames) - ASCIZ "foobar" +#ifndef EVCNT_COUNTERS + INTRNAMES_DEFINITION +#endif EXPORT(eintrnames) .align 3 EXPORT(intrcnt) - .quad 0 +#ifndef EVCNT_COUNTERS + INTRCNT_DEFINITION +#endif EXPORT(eintrcnt) .text Index: include/intr.h =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/alpha/include/intr.h,v retrieving revision 1.4 diff -u -r1.4 intr.h --- intr.h 1998/11/15 18:25:16 1.4 +++ intr.h 1998/11/28 02:12:01 @@ -30,7 +30,7 @@ #define _MACHINE_INTR_H_ int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg, - void **cookiep); + void **cookiep, volatile long *cntp); int alpha_teardown_intr(void *cookie); void alpha_dispatch_intr(void *frame, unsigned long vector); Index: isa/isa.c =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/alpha/isa/isa.c,v retrieving revision 1.7 diff -u -r1.7 isa.c --- isa.c 1998/11/18 23:53:11 1.7 +++ isa.c 1998/11/28 01:53:51 @@ -37,6 +37,7 @@ #include <isa/isareg.h> #include <isa/isavar.h> #include <machine/intr.h> +#include <machine/intrcnt.h> #include <machine/resource.h> MALLOC_DEFINE(M_ISADEV, "isadev", "ISA device"); @@ -654,7 +655,8 @@ ii->irq = irq->r_start; error = alpha_setup_intr(0x800 + (irq->r_start << 4), - isa_handle_intr, ii, &ii->ih); + isa_handle_intr, ii, &ii->ih, + &intrcnt[INTRCNT_ISA_IRQ + irq->r_start]); if (error) { free(ii, M_DEVBUF); return error; Index: pci/cia.c =================================================================== RCS file: /pub/FreeBSD-CVS/src/sys/alpha/pci/cia.c,v retrieving revision 1.11 diff -u -r1.11 cia.c --- cia.c 1998/11/15 18:25:16 1.11 +++ cia.c 1998/11/28 01:57:57 @@ -104,6 +104,7 @@ #include <machine/bwx.h> #include <machine/swiz.h> #include <machine/intr.h> +#include <machine/intrcnt.h> #include <machine/cpuconf.h> #include <machine/rpb.h> #include <machine/resource.h> @@ -825,7 +826,6 @@ struct resource *irq, driver_intr_t *intr, void *arg, void **cookiep) { - struct alpha_intr *i; int error; error = rman_activate_resource(irq); @@ -833,7 +833,8 @@ return error; error = alpha_setup_intr(0x900 + (irq->r_start << 4), - intr, arg, cookiep); + intr, arg, cookiep, + &intrcnt[INTRCNT_EB164_IRQ + irq->r_start]); if (error) return error; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981128113816T.simokawa>