Subject: Re: i386 interrupt counters
To: Michael Graff <>
From: Chris G Demetriou <>
List: tech-kern
Date: 08/11/1996 15:19:49
> Noriyuki Soda <> writes:
> > I think it is better to use driver name like "com0" instead of
> > "intr4". Of course, this requires to handle return value of interrupt
> > handler to cope with shared irq.
> > 
> > BTW, do you use "struct evcnt" to implement it ? (see sparc port)
> No, but I suspect I should be, no?  ;)
> Right now I'm doing the old static name thing.  I think that will change.

Probably not.

The way 'evcnt' interrupt counters work is fatally brain-dead,
in my opinion.  Look at the Alpha port for my solution: i use 'the old
static name thing,' but i've cleaned it up a bit so it's more

What's fatally brain-dead about the current evcnt interrupt code?

The big lose is that you only can have one interrupt counter per
device, the device's evcnt counter with the name "intr."

What that means is that you have to do interrupt counting in the
drivers.  That is a lose on busses like ISA/EISA/PCI, where there's
no one-to-one interrupt to device (slot) mapping.  It effectively
means that you can't easily tell what IRQs are being most heavily
pounded, and can't even obviously tell from 'vmstat -i' output
which IRQs are _in use_!

It also has the disadvantage that there's no logical place to record
stray interrupts.  For instance, if the CPU sees an interrupt on an
interrupt line and there is no device attached, or no device claims
the interrupt, then there's no good place to record the fact that
the CPU was interrupted by the given line.

With evcnt, the 'total' output ends up not being a good representation
of how many interrupts were actually taken by the CPU (rather than how
many interrupt handlers were called).

Basically, i see no reason that interrupt counting should be done in
the device code _instead_ of in the bus code, and several reasons why
it _should_ be done in the bus code.  using evcnt for interrupts
doesn't let you do this.

In a perfect interrupt counting system, you would be able to
do the counting in _both_, and say "this device interrupt is also
known as this bus interrupt."  This would allow one to see how many
times multiple devices interrupted _at the same time_ on the line,
would allow better tracking of stray interrupts, etc., and would be
friendlier to loadable devices.

So, i guess the summary is, in my opinion, 'evcnt' may be useful for
per-device event counters, but it sucks if you're trying to keep track
of interrupts, which are _not_ "per-device," but rather "per-bus" on
many systems, including PCs (and all other systems on which interrupt
sharing can happen).