As a general rule, kernel developers work to avoid running code in hardware
interrupt context; there is a whole array of mechanisms by which
interrupt-driven work can be deferred to less pressing times. Apparently,
however, there is an occasional need to run arbitrary code in the hardware
interrupt context - and there is no hardware conveniently signaling
interrupts at the time. To enable the running of code in hardware
interrupt context, a new API has been added to 2.6.37.
The first step is to fill in an irq_work structure:
struct irq_work my_work;
init_irq_work(struct irq_work *entry, void (*func)(struct irq_work *func));
There is then a fairly familiar pair of functions for running the work
indicated by this structure:
bool irq_work_queue(struct irq_work *entry);
void irq_work_sync(struct irq_work *entry);
The intended area of use is apparently code running from non-maskable
interrupts which needs to be able to interact with the rest of the system.
One should assume that just about any other use of this feature is likely
to be scrutinized closely.
to post comments)