Keyronex Keyronex manual pages

IPL(9) Kernel Developer's Manual IPL(9)

ipl, splraise, spldpc, splx, splgetraise or lower Interrupt Priority Level (IPL)

#include <kdk/kern.h>

ipl_t
splraise(ipl_t ipl);

ipl_t
spldpc(ipl_t ipl);

void
splx(ipl_t ipl);

ipl_t
splget(void);

These functions are used to modify the interrupt priority level. They are used to block certain categories of interrupts to ensure safe execution of critical sections of code.

Interrupts are masked by priority, and priorities are hierarchical. When the interrupt priority level is raised, lower-priority interrupts are disabled until the priority level is lowered. This affects delivery of interrupts within the thread that has raised the level. Levels kIPLDPC and above prevent rescheduling, and therefore act on the CPU core as a whole.

Each interrupt handler is associated with an IPL. Entry to an interrupt handler is always at the IPL the handler is associated with. The IPL can be further raised above that level, but must return to the handler's associated IPL before return.

The rcu(9) and the spinlock(9) functionalities also modify IPL as part of their duties.

These are the interrupt priority levels from low-to-high, with each higher level blocking additional interrupts:

Allows all interrupts. This is the lowest interrupt priority level. All categories of interrupts are unblocked.

Blocks asynchronous system traps (ASTs) targeting the current thread.

Additionally blocks dispatch-level interrupts.

This is the level at which the scheduler, DPCs, and RCU callbacks run. At this level and above, the current processor core will not be rescheduled, RCU grace periods will not end, and DPCs will not run.

Additionally blocks general device-level interrupts.

Additionally blocks the harldcock interrupt.

Additionally blocks most inter-processor interrupts (IPIs.)

Blocks all interrupts. This is the highest interrupt priority level.

Note: On some architectures, consecutive subsets of the first four interrupt levels (kIPLHigh, kIPLIPI, kIPLClock, kIPLDevice) may be merged due to platform-specific limitations.

As shorthand, "low IPL" refers to IPL less than kIPLDPC, and "high IPL" refers to IPL greater than or equal to kIPLDPC.

The following functions are provided for managing the interrupt priority level:

(ipl_t ipl)
Raises the current interrupt priority level to ipl and returns the previous IPL.
(void)
Raises the current interrupt priority level to kIPLDPC. and returns the previous IPL.
(ipl_t ipl)
Restores the interrupt priority level to ipl. This function is used to lower the priority level after completing a section that must run at high IPL.
(void)
Returns the current interrupt priority level.

The ipl interface has always been in Keyronex.

October 5, 2024 Debian