linux kernel-interrupt

1. Interrupts and exceptions

Insert picture description here
Insert picture description here
Insert picture description here

2. Top and bottom concepts

Insert picture description here

3. Reentry and sharing of interrupt handlers

Insert picture description here
Insert picture description here

4. Interrupt Context

The interrupt context cannot call the sleep function, because the kernel scheduling is scheduled in the unit of process. Once the interrupt handler sleeps, the scheduler schedules other processes to run, it cannot be rescheduled back to this interrupt handler to continue execution
as an interrupt handler When the program is executing, the interrupt line is shielded on all processors to prevent receiving another new same interrupt on the same interrupt line.
But this interrupt handler may be interrupted by other interrupt lines
Insert picture description here

5. Interrupt handling mechanism

If need_resched (re-schedule is required) is set, and the kernel is returning to user space (that is, the user program is interrupted), then schedule is called; if the kernel is returning to kernel space (that is, the kernel itself is interrupted), then only in preempt_count Schedule is called when it is 0, otherwise it is not safe to preempt the kernel. If there is no suspended work after calling schedule, then the original register is restored, and the kernel is restored to the point where it was interrupted.
Insert picture description here
Insert picture description here

6. View the interrupt command

cat /proc/interrupts

Insert picture description here
Insert picture description here

7. Interrupt control

Insert picture description here

Guess you like

Origin blog.csdn.net/chengcheng1024/article/details/114026255