Subject: Re: blocked interrupts (was CVS commit: src/sys/arch/arc)
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Simon Burge <simonb@wasabisystems.com>
List: port-mips
Date: 11/19/2005 02:08:33
Izumi Tsutsui wrote:

> In article <20051118132954.C437823403@thoreau.thistledown.com.au>
> simonb@wasabisystems.com wrote:
> 
> > Ah, the case where we come in to cpu_intr() with only soft interrupts?
> > Indeed we'll then leave all interrupts disabled while we process the
> > software interrupts.
> 
> I wonder why such a trivial bug is left even though it has already
> been noted in TODO. (I'm afraid there might be any bad side effects ;-)

Just as a simple test, I added some instrumentation to the sbmips port
to count what we do when we come in to cpu_intr().  These figures are
for booting to multiuser then building tcsh in pkgsrc:

	evcnt type 1: cpu_intr hard-only = 120263
	evcnt type 1: cpu_intr soft-only = 240193
	evcnt type 1: cpu_intr hard-soft = 102
	evcnt type 1: cpu_intr none = 93

Interesting that we get nearly twice as many software interrupts as
hardware interrupts, and so few of both together at the same time.
Also, we came in to cpu_intr() a few times with ipending == 0(!).

> > Does it make sense to have _clrsoftintr() enable interrupts?  It's not
> > quite the right name for such a function, but I guess it makes sense
> > for it to enable interrupts.  I'm not sure whether we should rename it
> > though (or what to rename it to).
> 
> All _clrsoftintr() is placed just before softintr hander so
> it seems ok though I don't know good name for the function either.
> _acksoftintr()? _enablesoftintr()? inline asm in MI softintr_dispatch()?

_clrsoftintr_and_enable_hw_interrupts() is about the best description,
but obviously way too long for a function name!  Maybe just leave the
name and document that it enables hardware interrupts?

> > As an aside, it looks like it would make sense to put the prototype for
> > _clrsoftintr() in <mips/softintr.h>, and remove it from <machine/intr.h>
> > for those ports that use the MIPS "MI" softintrs.  Do you agree?
> 
> Looks okay, but it's better (and trivial) to fix ports which
> haven't switched to MI softintr? ;-)
> (playstation2 uses the one-shot timer rather than mips _setsoftintr()
>  for softintr though)

Yes, the remaining ports (with perhaps the exception of playstation2?)
should be converted.  I'm actually planning to move algor in to evbmips,
which will fix that one.  mipsco should be simple, and I'll leave hpcmips
alone :-)

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/