Function calling the bottom half of the interrupt handler on linux

In Linux, interrupt handling is divided into two components: an upper half and a lower half.

In my opinion, the bottom half of the interrupt handler can be handled in different ways: softirq, tasklet, work-queue, and timer-list.

I want to know what function (s) in Linux kernel handle the scheduling function of these lower halves.

Edit: I looked into the halndling softirq and tasklet's and it seems like they are both handled via __ do_softirq ( http://lxr.linux.no/linux+v2.6.32.58/kernel/softirq.c#L207 ). However, I can still see many paths inside the handler execution that go through the schedule () function of the Linux kernel and then show a discrepancy. I cannot explain these paths correctly.

Some intuition to guide this function:
Scheduling a pending task (bottom half) should be triggered by some event. Kernel events can be either a system call or an interrupt. I believe that the event that triggers the bottom half is an interrupt and not a system call.

To my knowledge, these are the steps that have been taken on arrival interrupts:
 1. Interruption comes into the core
 2. The top half of the interrupt handler starts
 . 3. Check the pending queue to see if there is a task requiring attention.
 4. If there is any unfinished task, complete it

I went through the list of functions of all OS handlers and observed that many of the handlers were executed through the schedule () function of the Linux kernel. Since this function is so often called from among many interrupt handlers, I believe that the bottom half of the interrupt handlers should only be called within this function.

The schedule () function calls the post_schedule () function at the end. I have kept track of all the functions in between these two function calls. There are many different function lists in between, which raises the suspicion that the bottom half functions must lie in the path from schedule () to post_schedule (). However, the sheer number of different MACROS and functions in the kernel makes it difficult to pinpoint the function from which the scheduler jumps to the bottom half.

+3


source to share


1 answer


The top half of the device driver interrupt handler should return IRQ_HANDLED, IRQ_WAKE_THREAD, or IRQ_NONE to indicate which interrupt subsystem is handling irqs or not. If IRQ_WAKE_THREAD is returned, then the bottom half of the interrupt handler portion is scheduled for execution. Usually the lower halves take precedence over other normal kernel tasks. See https://lwn.net/Articles/302043/ for details



+1


source







All Articles