diff --git a/sys/arch/alpha/alpha/interrupt.c b/sys/arch/alpha/alpha/interrupt.c index 7bcbee2c0eb5..444d882edfff 100644 --- a/sys/arch/alpha/alpha/interrupt.c +++ b/sys/arch/alpha/alpha/interrupt.c @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.46 2000/06/03 20:47:36 thorpej Exp $ */ +/* $NetBSD: interrupt.c,v 1.47 2000/06/04 03:40:03 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.46 2000/06/03 20:47:36 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.47 2000/06/04 03:40:03 thorpej Exp $"); #include #include @@ -166,6 +166,8 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2, { u_long pending_ipis, bit; + atomic_add_ulong(&ci->ci_intrdepth, 1); + #if 0 printf("CPU %lu got IPI\n", cpu_id); #endif @@ -190,6 +192,8 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2, if (ci->ci_cpuid == hwrpb->rpb_primary_cpu_id && hwrpb->rpb_txrdy != 0) cpu_iccb_receive(); + + atomic_sub_ulong(&ci->ci_intrdepth, 1); } #else printf("WARNING: received interprocessor interrupt!\n"); @@ -197,6 +201,12 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2, break; case ALPHA_INTR_CLOCK: /* clock interrupt */ + /* + * We don't increment the interrupt depth for the + * clock interrupt, since it is *sampled* from + * the clock interrupt, so if we did, all system + * time would be counted as interrupt time. + */ #if defined(MULTIPROCESSOR) /* XXX XXX XXX */ if (CPU_IS_PRIMARY(ci) == 0) @@ -223,11 +233,13 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2, break; case ALPHA_INTR_ERROR: /* Machine Check or Correctable Error */ + atomic_add_ulong(&ci->ci_intrdepth, 1); a0 = alpha_pal_rdmces(); if (platform.mcheck_handler) (*platform.mcheck_handler)(a0, framep, a1, a2); else machine_check(a0, framep, a1, a2); + atomic_sub_ulong(&ci->ci_intrdepth, 1); break; case ALPHA_INTR_DEVICE: /* I/O device interrupt */ @@ -236,9 +248,11 @@ interrupt(unsigned long a0, unsigned long a1, unsigned long a2, if (CPU_IS_PRIMARY(ci) == 0) return; #endif + atomic_add_ulong(&ci->ci_intrdepth, 1); uvmexp.intrs++; if (platform.iointr) (*platform.iointr)(framep, a1); + atomic_sub_ulong(&ci->ci_intrdepth, 1); break; case ALPHA_INTR_PERF: /* performance counter interrupt */ diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h index 3226364fb1b9..72145f066a20 100644 --- a/sys/arch/alpha/include/cpu.h +++ b/sys/arch/alpha/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.41 2000/06/03 20:47:40 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.42 2000/06/04 03:40:04 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -128,6 +128,7 @@ struct cpu_info { struct device *ci_dev; /* pointer to our device */ u_long ci_want_resched; /* preempt current process */ u_long ci_astpending; /* AST is pending */ + u_long ci_intrdepth; /* interrupt trap depth */ #if defined(MULTIPROCESSOR) u_long ci_flags; /* flags; see below */ u_long ci_ipis; /* interprocessor interrupts pending */ @@ -179,11 +180,13 @@ struct clockframe { #define CLKF_BASEPRI(framep) \ (((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_IPL_MASK) == 0) #define CLKF_PC(framep) ((framep)->cf_tf.tf_regs[FRAME_PC]) + /* - * XXX No way to accurately tell if we were in interrupt mode before taking - * clock interrupt. + * This isn't perfect; if the clock interrupt comes in before the + * r/m/w cycle is complete, we won't be counted... but it's not + * like this stastic has to be extremely accurate. */ -#define CLKF_INTR(framep) (0) +#define CLKF_INTR(framep) (curcpu()->ci_intrdepth) /* * Preempt the current process if in interrupt from user mode,