Message signaled interrupts

On this page 8

Message signaled interrupts (MSI) are an interrupt mechanism in which a device signals the processor by performing an ordinary memory write of a data value to a reserved address, instead of asserting a dedicated physical interrupt line. In operating systems, MSI and its extended form MSI-X are the standard way PCI Express devices request attention from drivers and devices code in the kernel.

The mechanism was introduced in the PCI 2.2 specification and expanded with MSI-X in PCI 3.0. On PCI Express, the older pin-based interrupts survive only as emulated messages, so MSI or MSI-X is the native interrupt path for network adapters, NVMe drives, GPUs and most other modern peripherals.

How a message signaled interrupt travels

A message signaled interrupt is a posted memory write transaction that the interrupt controller recognizes as an interrupt. During initialization, the operating system programs the device with a target message address and a message data value. When an event occurs, the device writes that data to that address, exactly as it would write a DMA buffer.

On x86 systems, the address falls in the 0xFEE00000 region that the local APIC decodes. The address selects the destination CPU, and the data field carries the interrupt vector number and delivery mode. On Arm platforms, the write typically targets the GICv3 Interrupt Translation Service (ITS), which converts the device identifier and event identifier into a processor interrupt.

Because the interrupt is itself a write on the same path as data, PCI ordering rules guarantee that earlier DMA writes are visible before the interrupt arrives. Pin-based interrupts lacked this property, and drivers often had to read a device register to flush buffered data.

MSI and MSI-X compared

MSI and MSI-X share the same principle but differ in how many vectors a device can use and how flexibly each vector can be steered. The table below lists the main differences defined by the PCI specifications.

PropertyMSIMSI-X
Introduced inPCI 2.2PCI 3.0
Maximum vectors per function322048
Vector allocationPower of two, contiguousAny number, independent
Address per vectorOne shared addressSeparate address per entry
Per-vector maskingOptionalAlways available
Configuration storageConfiguration space capabilityTable in a memory BAR
Capabilities of MSI and MSI-X

The independent address per entry is what makes MSI-X attractive for multiqueue hardware. Each transmit or receive queue of a network adapter, or each submission and completion queue pair of an NVMe controller, can interrupt a different CPU core, which keeps cache lines local and spreads load evenly.

Advantages over pin-based interrupt requests

Message signaled interrupts solve problems that accumulated with legacy INTx interrupt lines, which on conventional PCI were limited to four pins per slot and were commonly shared among several devices.

AspectPin-based INTxMessage signaled
SharingLines often sharedEach vector is exclusive
Trigger typeLevel-triggeredEdge-like, one message per event
Data orderingRequires flushing readOrdered behind prior DMA writes
Vectors per deviceOneUp to 32 or 2048
CPU targetingThrough routing tablesEncoded in the message address
Pin-based versus message signaled delivery

Exclusive vectors remove the need for an interrupt service routine to poll several devices to discover which one fired. Combined with per-CPU targeting, this lowers interrupt latency and reduces the risk of interrupt storms caused by a stuck shared line.

Fields of the MSI-X table entry

Each MSI-X vector is described by a 16-byte table entry located in device memory that a BAR maps. The kernel writes these entries during setup and may rewrite them later, for example when interrupt affinity moves a vector to another core.

FieldSizePurpose
Message address32 bitsLower part of the target address
Message upper address32 bitsUpper part for 64-bit addressing
Message data32 bitsValue written, encoding the vector
Vector control32 bitsContains the per-vector mask bit
Layout of one MSI-X table entry

A separate pending bit array records events that occurred while a vector was masked, so the device can deliver them once the mask is cleared. This design lets the operating system retarget or pause a single vector safely without disabling the whole function, which classic MSI cannot always guarantee.

Operating system and driver support

Kernel support for message signaled interrupts is mature in all major desktop systems, and drivers usually request MSI-X first, fall back to MSI, and use INTx only as a last resort.

  • Linux drivers call pci_alloc_irq_vectors() with flags that permit MSI-X, MSI or legacy delivery, and the vectors appear as PCI-MSI entries in /proc/interrupts.
  • Windows has supported MSI since Windows Vista; a driver opts in through its INF file, and the MSISupported registry value controls the behavior per device.
  • macOS exposes MSI through the I/O Kit interrupt sources of a PCI device, and Apple silicon systems route messages through their own interrupt controller.

In virtualized systems, the IOMMU interrupt remapping feature, such as Intel VT-d interrupt remapping or the AMD equivalent, validates each message before delivery. Without remapping, a device assigned to a guest could forge writes to the APIC range and inject arbitrary interrupts into the host.

Limitations and troubleshooting

Message signaled interrupts are robust, but hardware quirks and resource limits still cause problems. The following table maps common symptoms to their causes.

SymptomLikely causeTypical remedy
Device works only with MSI disabledChipset or firmware MSI defectKernel quirk or firmware update
Fewer vectors than queuesx86 per-CPU vector space exhaustedReduce queues or share vectors
Lost or spurious interruptsMissing per-vector masking under MSIPrefer MSI-X when available
Interrupts blocked in a virtual machineInterrupt remapping disabledEnable remapping in firmware
Typical MSI problems and remedies

Each x86 CPU has only about 200 usable interrupt vectors, so servers with many multiqueue devices can run short, and the kernel then reduces the queue count. Because messages are edge-like, a driver that fails to acknowledge an event can miss subsequent notifications until the device is reset.

A non-technical view

Older hardware asked the processor for attention by pulling on a shared wire, like a bell that several rooms use. The processor then had to check every room to find who rang.

With message signaled interrupts, each device instead sends a short note to a known mailbox. The note says exactly who is asking and which processor core should answer. Nothing is shared and nothing is guessed, so the computer reacts faster and wastes less effort.

A concrete example

A file server with 16 CPU cores uses a 25 Gb/s network adapter with 16 receive queues. In its default configuration, the driver allocates 17 MSI-X vectors: one per queue and one for link and error events. The administrator sees each queue listed as a separate PCI-MSI line in the interrupt statistics.

During a backup window, traffic peaks at about 2 million packets per second. Because each queue interrupts its own core, no single CPU saturates, and packet processing stays local to the cache that received the data. When the administrator once tested the card with MSI disabled, all traffic fell back to a single shared line and one core reached 100 percent load while others stayed idle.

Restoring MSI-X brought throughput back to line rate and cut average interrupt handling time per packet noticeably. The case shows that vector count and CPU targeting matter as much as raw link speed.