As we stated at the beginning of this chapter, interrupt handling in Linux presents relatively few compatibility problems with older kernels. There are a few, however, which we discuss here. Most of the changes occurred between versions 2.0 and 2.2 of the kernel; interrupt handling has been remarkably stable since then.
The biggest change since the 2.2 series has been the addition of tasklets in kernel 2.3.43. Prior to this change, the BH bottom-half mechanism was the only way for interrupt handlers to schedule deferred work.
The set_current_state function did not exist in
Linux 2.2 (but sysdep.h
implements it). To
manipulate the current process state, it was necessary to manipulate
the task structure directly. For example:
current->state = TASK_INTERRUPTIBLE;
In Linux 2.0, there were many more differences between fast and slow handlers. Slow handlers were slower even before they began to execute, because of extra setup costs in the kernel. Fast handlers saved time not only by keeping interrupts disabled, but also by not checking for bottom halves before returning from the interrupt. Thus, the delay before the execution of a bottom half marked in an interrupt handler could be longer in the 2.0 kernel. Finally, when an IRQ line was being shared in the 2.0 kernel, all of the registered handlers had to be either fast or slow; the two modes could not be mixed.
Most of the SMP issues did not exist in 2.0, of course. Interrupt handlers could only execute on one CPU at a time, so there was no distinction between disabling interrupts locally or globally.
The disable_irq_nosync function did not exist in 2.0; in addition, calls to disable_irq and enable_irq did not nest.
The atomic operations were different in 2.0. The functions
test_and_set_bit,
test_and_clear_bit, and
test_and_change_bit did not exist; instead,
set_bit, clear_bit, and
change_bit returned a value and functioned like
the modern test_and_ versions. For the integer
operations, atomic_t
was just a
typedef
for int
, and variables
of type atomic_t
could be manipulated like
int
s. The atomic_set and
atomic_read functions did not exist.
The wait_event and wait_event_interruptible macros did not exist in Linux 2.0.