Measuring time for which interrupts are disabled...

Balaji Srinivasan (
Tue, 20 Jan 1998 18:46:10 -0600 (CST)

Hi Everyone,

For our KU-Real-time Linux, I am trying to find out the durations for
which interrupts are disabled in the various parts of the Linux kernel.

I have already put hooks into the kernel so that all calls to cli(), sti()
and restore_flags() log the event first and then does the necessary action.
These hooks, first check whether the call will actually change the status
of the IF flag in the EFLAGS register. Only those calls that do will get
logged. This assures that nested calls dont get logged...

The problem that I am having is that the number of clis that get logged
is different from the number of sti's. I have already made modifications
so that in do_IRQ (in arch/i386/kernel/irq.c) directly does enable interrupts
without going through the hook. Is there any other place in the kernel that
I need to modify too? (ie. is there any other place in the kernel that
call sti first since the hardware automatically disables interrupts before
jumping to the handler?)

I would appreciate any help on this.
PS: Another thing that ive noticed is that do_bottom_half (in kernel/softirq.c)
does an sti without doing a cli. This is ok in the case do_bottom_half
is called from do_IRQ, but when do_bottom_half is called from schedule()
wouldnt this be dangerous? or am i missing something?
Also run_old_timers does an sti without doing a that a non-fatal

Balaji Srinivasan