APIC(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– APIC β€” the Advanced Programmable Interrupt Controller driver πŸ’–

okay bestie, buckle up, we're talking about apic(4) β€” the Advanced Programmable Interrupt Controller (APIC) driver, straight out of the Kernel Interfaces Manual. this one's a banger, ngl πŸŽ€


✨ SYNOPSIS ✨

so first thing's first: this driver is a mandatory part of the amd64 kernel. like, you don't get to opt out, it's giving main character energy and it's non-negotiable πŸ’…

but if you're on an i386 kernel and you want to compile this driver in? no worries, just drop this line into your kernel configuration file:

device apic

slay. that's it. that's the whole ritual πŸ•―οΈβœ¨


πŸ¦‹ the tunables (settable from loader(8))

ok so you can also tweak stuff at the loader stage, and here's the tea:

  • hint.apic.X.clock β€” controls event timers functionality support. set it to 0 and you've disabled it. the default value is 1. iykyk 🌸
  • hint.apic.X.disabled β€” set this bad boy to 1 to disable APIC support entirely, falling back to the legacy PIC. (yes, the legacy PIC. we love a throwback πŸ™ˆ)

🌈 DESCRIPTION 🌈

okay so the Intel APIC system has two components, and honestly they're both icons in their own right πŸ‘‘

  • the local APIC (aka LAPIC) β€” there's one in each CPU in the system. per-CPU queen πŸ‘‘
  • the I/O APIC β€” there's typically one for each peripheral bus in the system.

so what do they do? glad you asked bestie 🫢

Local APICs manage all the external interrupts for a specific processor. and on top of that, they can accept and generate inter-processor interrupts (IPIs). multitasking icon behavior, fr fr πŸ’«

I/O APICs contain a redirection table, and that table is what routes the interrupts they receive from the peripheral buses over to one or more local APICs. it's giving air traffic control but make it interrupts ✈️


πŸŽ€ the event timer (yes, another one, and it slays)

each local APIC includes one 32-bit programmable timer, and this driver uses them to supply the kernel with one event timer named "LAPIC". iconic name, no notes πŸ’…

  • the event timer provided by the driver supports both one-shot and periodic modes ⏰
  • because of local APIC nature, it is per-CPU
  • the timer frequency is not reported by the platform, so the driver automatically measures it on the first use πŸ”¬
  • depending on CPU model, this timer may stop in C3 and deeper CPU sleep states 😴 (highkey concerning)
⚠️ but the driver has your back: it automatically adjusts event timer priority and reports it to prevent entering those dangerous sleep states when the timer is in use. safety queen behavior πŸ’–πŸ”₯

⭐ SEE ALSO ⭐

go read these next, bestie, they're all part of the same friend group:


and that's the whole page! πŸŽ€ this little love letter to interrupts comes to you from the Debian fam, dated June 19, 2020 β€” periodt. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from