		  Linux Interrupt Latency benchmark

	--| Description |--

This Linux kernel module measure the number of CPU tick that pass after
a device driver put _its_ irq line active until the irq handler will be
started.

	--| Compilation |--

-  Edit `./Makefile' and set the KERNEL variable to point to a writable linux
   source tree. You need a writable copy of it since the compilation stage
   need to only `touch` something.
-  Run `make`.

	--| Running |--

To run the benchmark you must `insmod` the module specifying as module
parameter the number of the hardware irq line in which generate the hardware
interrupt. For example something like this:

	# insmod ./lil.o irq=3 num=1 verbose=0 detect=1

will generate 1 irq on the line 3. The `irq' number is required and _must_
be >=0 and <= 15 since the irq is generated playing with the 8259 that handle
only the first 16 interrupt. `num' change the number of interrupt to generate
and can be every 32bit signed integer > 0. Don' t ask me what does it mean
`verbose' ;-), `verbose' can be 0 or 1. `detect' is default set to 0, and can
be set to 1 to detect irq bottleneck in the kernel code. For more info look
at the source dude ;-), search for detect_slow_irq(), it' s pretty simple.

To read the benchmark results you must run `dmesg` if you run X (or take a look
at /dev/xconsole if you are running a Debian system).

After the insmod you will see the message:

	./lil.o: init_module: Device or resource busy

INGNORE THIS MESSAGE, it has to happen because I wanted so.

	--| Technical details |--

The trick I use to generate the hardware interrupt is to trigger the
edge/level register of the 8259 irq controller so this module is really
i386 specific and not portable (and it won't work with motherboards
IO-APIC capable). Also the accounting of the time is not portable due the
use of the `rdtsc' asm instruction.

To not account the outb time I read the time stamp counter only after outb and
to assure that I' ll read the time stamp counter before the irq is run, I
cli() before the outb and I sti() after rdtsc. This should be a very good
compromise.

The mean is very very precise due the use of fpu.

Andrea Arcangeli <andrea@suse.de>
