The /proc/interrupts
file provides a real-time view of interrupt request (IRQ) statistics on Linux systems. Each line represents a unique interrupt source, showing how many times it's been triggered per CPU.
Here's what each column represents:
1. IRQ number
2-N. Interrupt counts per CPU core
N+1. Interrupt controller type (IRQ-IO-APIC, IR-PCI-MSI, etc.)
N+2. IRQ number and trigger mode
N+3. Device name associated with the interrupt
The number you see (like 524288-edge) actually contains two critical pieces of information:
- First part (numeric): This is the interrupt vector number used by the system. For PCI MSI (Message Signaled Interrupts), this represents the allocated message data.
- Second part (edge/level): Indicates the trigger mode:
edge
: Interrupt triggered on signal transition (rising or falling edge)level
: Interrupt remains active while signal is at specified levelfasteoi
: Fast End Of Interrupt handling
Let's examine two common scenarios:
1. Traditional IO-APIC interrupt:
0: 22 0 IR-IO-APIC 2-edge timer
Here '2-edge' means:
- Vector number: 2
- Trigger mode: edge-sensitive
2. PCI MSI interrupt:
123: 25164 5760490 IR-PCI-MSI 1048576-edge enp2s0
Here '1048576-edge' means:
- Message data: 1048576 (used for MSI/MSI-X)
- Trigger mode: edge-sensitive
The trigger mode affects how your system handles interrupts:
- Edge-triggered: Better for high-performance devices as they don't need continuous line assertion
- Level-triggered: Simpler but may require masking during handling
You can view and modify IRQ affinity with:
# Check current affinity
cat /proc/irq/123/smp_affinity
# Set affinity to CPU 0
echo 1 > /proc/irq/123/smp_affinity
For deeper analysis:
# View detailed MSI information
lspci -vvv | grep -A 5 MSI
# Check interrupt distribution
watch -n 1 "cat /proc/interrupts | grep enp2s0"
The /proc/interrupts
file in Linux provides crucial information about interrupt request (IRQ) statistics. Here's the complete breakdown of each column:
IRQ_NUM : CPU0_CNT CPU1_CNT ... : IRQ_TYPE : IRQ_CONFIG : DEVICE_NAME
The fifth column represents the interrupt configuration, consisting of two parts:
- Numerical part (e.g., 524288): This is the interrupt vector or identifier specific to the IRQ source
- Trigger type (e.g., edge): Indicates the interrupt triggering mode (edge-triggered or level-triggered)
Here are some common patterns you'll encounter:
# MSI (Message Signaled Interrupts) configuration
IRQ123: 25164 5760490 IR-PCI-MSI 1048576-edge enp2s0
# APIC configuration
IRQ0: 22 0 IR-IO-APIC 2-edge timer
# Legacy ISA configuration
IRQ1: 2 0 IR-IO-APIC 1-edge i8042
Let's examine some real-world cases:
Network Interface (enp2s0)
IRQ123: 25164 5760490 IR-PCI-MSI 1048576-edge enp2s0
This shows a high-performance network interface using MSI with:
- Vector: 1048576 (0x100000)
- Trigger: Edge
- Balanced across both CPUs
GPU Interrupt (amdgpu)
IRQ124: 17 5424414 IR-PCI-MSI 524288-edge amdgpu
This AMD GPU interrupt shows:
- Vector: 524288 (0x80000)
- Trigger: Edge
- Mostly handled by CPU1
You can verify CPU affinity for specific IRQs:
# cat /proc/irq/123/smp_affinity
3
Where '3' in binary (11) means both CPU0 and CPU1 can handle this interrupt.
To change the affinity for IRQ 123 to CPU0 only:
echo 1 > /proc/irq/123/smp_affinity
For high-performance applications:
- Use
irqbalance
for automatic distribution - Consider manual pinning for latency-sensitive applications
- MSI-X generally provides better performance than legacy interrupts
Use these commands for deeper analysis:
# View detailed IRQ info
lspci -vvv | grep -A 30 MSI
# Monitor interrupt rates
watch -d cat /proc/interrupts