Contents
How does Linux kernel handle interrupt?
In Linux the interrupt handling is done in three phases: critical, immediate and deferred. In the first phase the kernel will run the generic interrupt handler that determines the interrupt number, the interrupt handler for this particular interrupt and the interrupt controller.
What is interrupt in Linux?
An interrupt is simply a signal that the hardware can send when it wants the processor’s attention. Linux handles interrupts in much the same way that it handles signals in user space. For the most part, a driver need only register a handler for its device’s interrupts, and handle them properly when they arrive.
Where does the interrupt handler run in the kernel?
The interrupt handler runs in interrupt context. But you can access static variables declared outside the scope of the interrupt. If you want to be really confident with the do and don’t of interrupt handling, the best thing to read about is what a process is for the kernel.
How does Linux kernel find out which process to wake up?
Some user process issued a blocking read operation, triggering a sys call and the process is in the realm of kernel. Kernel sets up the disk controller requesting the needed data and puts this process on sleep (this process is put into a wait queue). Kernel schedules another process to run.
Where is the timer handler in the Linux kernel?
For x86, you’ll find the default PIT/HPET timer interrupt handler in arch/x86/kernel/time.c: This calls the event handler for global clock events, tick_handler_periodic by default, which updates the jiffies counter, calculates the global load, and updates a few other places where time is tracked.
How to handle generic IRQ in Linux kernel?
The descriptor structure contains status information and pointers to the interrupt flow method and the interrupt chip structure which are assigned to this interrupt. Whenever an interrupt triggers, the low-level architecture code calls into the generic interrupt code by calling desc->handle_irq ().