【笔记】关于多 CPU 系统了下的 APIC(Advanced Programmable Interrupt Controller)分配方式


External Interrupt Distribution in Multi-APIC System

Static Distribution
• According to Redirection Table (which is programmable)
Dynamic Distribution
• According to “lowest priority” scheme – Sent to the local APIC of the processor that is executing process with the lowest priority.
• Each local APIC has a programmable Task Priority Register (TPR), updated by OS to compute the priority of currently running process.

In Linux

• The booting CPU calls setup_IO_APIC_irqs() to initialize I/O APIC and set Redirection Table entries to allow all IRQs to be routed to each CPU based on “lowest priority” scheme.
• All CPUs then call setup_local_APIC() to initialize their own local APIC, and give a fixed value to TPR. 
• Linux kernel never modifies this value after initialization, resulting in a round-robin distribution of external IRQs among all the CPUs.