diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-15 21:27:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-15 21:27:23 +0000 |
commit | 218a1da66f25d990fb356d79530a0e89de3e4799 (patch) | |
tree | e6bf92928b5a8e105884558eb42873ec1ada8596 /sys/arch | |
parent | 75b63c9c752e79c0c8f087a640d7a0477511aebb (diff) |
Check for curcpu()->ci_softintr being nonzero before invoking dosoftint(),
in the common case, this saves us two potentially expensive setipl() calls.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/m88k/eh_common.S | 7 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/genassym.cf | 5 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88k_machdep.c | 23 |
3 files changed, 24 insertions, 11 deletions
diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S index 0d08e7b4e3d..09b36a66be8 100644 --- a/sys/arch/m88k/m88k/eh_common.S +++ b/sys/arch/m88k/m88k/eh_common.S @@ -1,4 +1,4 @@ -/* $OpenBSD: eh_common.S,v 1.31 2007/11/15 21:25:40 miod Exp $ */ +/* $OpenBSD: eh_common.S,v 1.32 2007/11/15 21:27:22 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -2346,6 +2346,11 @@ ASGLOBAL(check_ast) ld r2, FPTR, REG_OFF(EF_MASK) bcnd ne0, r2, _ASM_LABEL(ast_done) + /* save us the setipl calls if no pending software interrupts */ + ldcr r3, CPU + ld r2, r3, CI_SOFTINTR + bcnd eq0, r2, _ASM_LABEL(softint_done) + bsr.n _C_LABEL(setipl) or r2, r0, IPL_SOFTCLOCK bsr _C_LABEL(dosoftint) diff --git a/sys/arch/m88k/m88k/genassym.cf b/sys/arch/m88k/m88k/genassym.cf index 4b915cf0607..f57b6dd037f 100644 --- a/sys/arch/m88k/m88k/genassym.cf +++ b/sys/arch/m88k/m88k/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.13 2007/11/15 21:24:14 miod Exp $ +# $OpenBSD: genassym.cf,v 1.14 2007/11/15 21:27:22 miod Exp $ # # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -28,7 +28,7 @@ # SUCH DAMAGE. # # @(#)genassym.c 7.8 (Berkeley) 5/7/91 -# $Id: genassym.cf,v 1.13 2007/11/15 21:24:14 miod Exp $ +# $Id: genassym.cf,v 1.14 2007/11/15 21:27:22 miod Exp $ # include <sys/param.h> @@ -65,6 +65,7 @@ member ci_pfsr_i1 member ci_pfsr_d0 member ci_pfsr_d1 member ci_want_resched +member ci_softintr # general constants export UPAGES diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c index 481fbbe8ce1..5b3b5e4c16f 100644 --- a/sys/arch/m88k/m88k/m88k_machdep.c +++ b/sys/arch/m88k/m88k/m88k_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88k_machdep.c,v 1.30 2007/11/15 21:24:14 miod Exp $ */ +/* $OpenBSD: m88k_machdep.c,v 1.31 2007/11/15 21:27:22 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -310,17 +310,17 @@ int netisr; void dosoftint() { - int *ssir = &curcpu()->ci_softintr; + struct cpu_info *ci = curcpu(); int sir, n; - if ((sir = *ssir) == 0) + if ((sir = ci->ci_softintr) == 0) return; #ifdef MULTIPROCESSOR __mp_lock(&kernel_lock); #endif - atomic_clearbits_int(ssir, sir); + atomic_clearbits_int(&ci->ci_softintr, sir); uvmexp.softs++; if (ISSET(sir, SIR_NET)) { @@ -350,13 +350,20 @@ dosoftint() int spl0() { + struct cpu_info *ci = curcpu(); int s; - s = setipl(IPL_SOFTCLOCK); - - dosoftint(); + /* + * Try to avoid potentially expensive setipl calls if nothing + * seems to be pending. + */ + if (ci->ci_softintr != 0) { + s = setipl(IPL_SOFTCLOCK); + dosoftint(); + setipl(IPL_NONE); + } else + s = setipl(IPL_NONE); - setipl(IPL_NONE); return (s); } |