Skip to content

Commit 6110f8e

Browse files
committed
Rewrite the descriptions about bottom half
1 parent 5b953ee commit 6110f8e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lkmpg.tex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,8 +1557,12 @@ \subsection{Interrupt Handlers}
15571557
When the CPU receives an interrupt, it stops whatever it is doing (unless it is processing a more important interrupt, in which case it will deal with this one only when the more important one is done),
15581558
saves certain parameters on the stack and calls the interrupt handler.
15591559
This means that certain things are not allowed in the interrupt handler itself, because the system is in an unknown state.
1560-
The solution to this problem is for the interrupt handler to do what needs to be done immediately, usually read something from the hardware or send something to the hardware, and then schedule the handling of the new information at a later time (this is called the "bottom half") and return.
1561-
The kernel is then guaranteed to call the bottom half as soon as possible -- and when it does, everything allowed in kernel modules will be allowed.
1560+
% TODO: add some diagrams
1561+
Linux kernel solves the problem by splitting interrupt handling into two parts.
1562+
The first part executes right away and mask the interrupt line.
1563+
Hardware interrupts must be handled quick, and that is why we need the second part to handle the heavy work deferred from a interrupt handler.
1564+
Historically, BH (Linux naming for \textit{Bottom Halves}) statistically book-keeps the deferred functions.
1565+
\textbf{Softirq} and its higher level abstraction, \textbf{Tasklet}, replace BH since Linux 2.3.
15621566

15631567
The way to implement this is to call \cpp|request_irq()| to get your interrupt handler called when the relevant IRQ is received.
15641568

0 commit comments

Comments
 (0)