From 77dd4deaa6f87ba38b0ba8902728d4bc791e9a4c Mon Sep 17 00:00:00 2001 From: aymeric Date: Wed, 7 Nov 2001 23:25:03 +0000 Subject: [PATCH] introduce an interrupt_depth variable which counts how nested we are into interrupts. This allows hardclock() to account for the time spent in interrrupts, and as a side-effect, top(1), systat(1) and others will no more report 0% of interrupt activity. mvme68k does that already. --- sys/arch/amiga/amiga/locore.s | 19 ++++++++++++++++++- sys/arch/amiga/amiga/machdep.c | 4 +++- sys/arch/amiga/include/cpu.h | 11 +++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s index 9e54874907c1..a981c5d0ddbd 100644 --- a/sys/arch/amiga/amiga/locore.s +++ b/sys/arch/amiga/amiga/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.125 2001/07/22 13:34:02 wiz Exp $ */ +/* $NetBSD: locore.s,v 1.126 2001/11/07 23:25:03 aymeric Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -447,11 +447,14 @@ ENTRY_NOPROFILE(trace) */ ENTRY_NOPROFILE(spurintr) + addql #1,_C_LABEL(interrupt_depth) addql #1,_C_LABEL(intrcnt)+0 addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) ENTRY_NOPROFILE(lev5intr) + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%d1/%a0/%a1,%sp@- #include "ser.h" #if NSER > 0 @@ -463,10 +466,12 @@ ENTRY_NOPROFILE(lev5intr) moveml %sp@+,%d0/%d1/%a0/%a1 addql #1,_C_LABEL(intrcnt)+20 addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) #ifdef DRACO ENTRY_NOPROFILE(DraCoLev2intr) + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%d1/%a0/%a1,%sp@- CIAAADDR(%a0) @@ -490,10 +495,12 @@ ENTRY_NOPROFILE(DraCoLev2intr) Ldraciaend: moveml %sp@+,%d0/%d1/%a0/%a1 addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) /* XXX on the DraCo rev. 4 or later, lev 1 is vectored here. */ ENTRY_NOPROFILE(DraCoLev1intr) + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%d1/%a0/%a1,%sp@- movl _C_LABEL(draco_ioct),%a0 btst #5,%a0@(7) @@ -522,10 +529,12 @@ Ldrclockretry: moveml %sp@+,%d0/%d1/%a0/%a1 addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) | XXXX: shouldn't we call the normal lev1? /* XXX on the DraCo, lev 1, 3, 4, 5 and 6 are vectored here by initcpu() */ ENTRY_NOPROFILE(DraCoIntr) + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%d1/%a0/%a1,%sp@- Ldrintrcommon: lea _ASM_LABEL(Drintrcnt)-4,%a0 @@ -538,6 +547,7 @@ Ldrintrcommon: addql #4,%sp | pop SR moveml %sp@+,%d0/%d1/%a0/%a1 addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) #endif @@ -548,6 +558,7 @@ ENTRY_NOPROFILE(lev3intr) #ifndef LEV6_DEFER ENTRY_NOPROFILE(lev4intr) #endif + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%d1/%a0/%a1,%sp@- Lintrcommon: lea _C_LABEL(intrcnt),%a0 @@ -560,6 +571,7 @@ Lintrcommon: addql #4,%sp | pop SR moveml %sp@+,%d0/%d1/%a0/%a1 addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) /* XXX used to be ifndef DRACO; vector will be overwritten by initcpu() */ @@ -571,6 +583,7 @@ ENTRY_NOPROFILE(lev6intr) * as we return. Block generation of level 6 ints until * we have dealt with this one. */ + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%a0,%sp@- INTREQRADDR(%a0) movew %a0@,%d0 @@ -582,15 +595,18 @@ ENTRY_NOPROFILE(lev6intr) movew #INTF_EXTER,%a0@ movew #INTF_SETCLR+INTF_AUD3,%a0@ | make sure THIS one is ok... moveml %sp@+,%d0/%a0 + subql #1,_C_LABEL(interrupt_depth) rte Llev6spur: addql #1,_C_LABEL(intrcnt)+36 | count spurious level 6 interrupts moveml %sp@+,%d0/%a0 + subql #1,_C_LABEL(interrupt_depth) rte ENTRY_NOPROFILE(lev4intr) ENTRY_NOPROFILE(fake_lev6intr) #endif + addql #1,_C_LABEL(interrupt_depth) moveml %d0/%d1/%a0/%a1,%sp@- #ifdef LEV6_DEFER /* @@ -634,6 +650,7 @@ Lskipciab: Llev6done: moveml %sp@+,%d0/%d1/%a0/%a1 | restore scratch regs addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS + subql #1,_C_LABEL(interrupt_depth) jra _ASM_LABEL(rei) | all done [can we do rte here?] Lchkexter: | check to see if EXTER request is really set? diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index 2e38f7984db9..1ac225a6e781 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.164 2001/09/10 21:19:10 chris Exp $ */ +/* $NetBSD: machdep.c,v 1.165 2001/11/07 23:25:03 aymeric Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -122,6 +122,8 @@ void ser_outintr __P((void)); void fdintr __P((int)); #endif +volatile unsigned int interrupt_depth = 0; + /* * patched by some devices at attach time (currently, only the coms) */ diff --git a/sys/arch/amiga/include/cpu.h b/sys/arch/amiga/include/cpu.h index e4aa67066f66..dc08fe13a0e4 100644 --- a/sys/arch/amiga/include/cpu.h +++ b/sys/arch/amiga/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.52 2001/05/30 12:28:39 mrg Exp $ */ +/* $NetBSD: cpu.h,v 1.53 2001/11/07 23:25:04 aymeric Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -81,6 +81,7 @@ extern struct cpu_info cpu_info_store; #define cpu_swapout(p) /* nothing */ #define cpu_number() 0 +extern volatile unsigned int interrupt_depth; /* * Arguments to hardclock and gatherstats encapsulate the previous * machine state in an opaque clockframe. One the hp300, we use @@ -96,13 +97,7 @@ struct clockframe { /*#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0)*/ #define CLKF_BASEPRI(framep) (0) #define CLKF_PC(framep) ((framep)->pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#define CLKF_INTR(framep) (0) /* XXX */ -#endif +#define CLKF_INTR(framep) (interrupt_depth > 1) /*