Linux in_Irq Explained: What It Means in Kernel Logs

Linux in_Irq Explained: What It Means in Kernel Logs

Linux in_irq is a kernel-context flag, not a Windows BSOD code. It means code is running inside an interrupt handler, so it is generally treated as driver, hardware, or platform context rather than a Windows stop error. Mixing the two points you at the wrong OS layer, and you end up checking the wrong driver, firmware, or crash path. This guide shows how to read in_irq messages and separate IRQ faults from Windows crash codes. For terminology and handler behavior, see the Linux kernel documentation for generic IRQ handling, interrupt flow handlers, the request_irq() API, procfs, and irqbalance project docs. [kernel.org: genericirq, request_irq, procfs, irqbalance]

What linux in_irq means

in_irq means the current code is running in interrupt context inside the Linux kernel, not in ordinary process context. That matters because interrupt handlers have tighter rules: they should do urgent work and defer the rest. A log line that mentions in_irq is usually telling you where the kernel was executing, not naming a stop code. In kernel terms, this sits in the hard-IRQ path or nearby interrupt handling path, not in user space. [kernel.org: genericirq, request_irq]

Key points: What linux in_irq means

Why it is not a Windows stop code

Windows BSOD text and Linux kernel log semantics are different layers. A Windows stop error appears in the operating system crash path, while in_irq is a Linux kernel state flag used during interrupt handling. If you see both terms in a support thread, separate the machine that crashed from the log that mentions in_irq before drawing conclusions. That cross-OS distinction matters because Windows bugcheck names do not explain Linux interrupt context, and Linux interrupt context does not identify a Windows bugcheck. [kernel.org: genericirq]

How to read it beside adjacent log lines

Read the line before and after the in_irq message. Look for the driver name, the device class, and any mention of an IRQ number, a faulting function, or repeated retries. A single in_irq mention beside a network driver warning points you toward interrupt handling. Repeated entries with the same line number point more toward a storm or a buggy handler. For debug context, correlate the kernel line with the matching entry in /proc/interrupts. [kernel.org: procfs, genericirq]

Say your laptop logs in_irq right after a Wi-Fi reset message, and the same IRQ line keeps counting up in /proc/interrupts. That pattern points to interrupt activity on the wireless device, not to a Windows-style stop code. The next step is to identify the driver and the interrupt line, then check whether the device is generating too many interrupts. In practice, I diagnose that by matching the dmesg timestamp to the IRQ row, then checking whether the handler path changed after a driver or firmware update. [kernel.org: procfs, genericirq, request_irq]

IRQ symptom vs. likely layerObservable signal, likely cause, first safe check
Windows BSOD textObservable signal: a stop screen with driver or bugcheck text. Likely cause: Windows crash path, not Linux in_irq. First safe check: record the exact stop code and the named driver before touching Linux logs.
Linux dmesg/kernel logObservable signal: in_irq or an interrupt-context warning beside a driver name. Likely cause: handler misuse, deferred-work mistake, or a device interrupt path. First safe check: capture the surrounding kernel lines and the IRQ number.
Device Manager /proc/interruptsObservable signal: Windows Device Manager shows an IRQ assignment, or Linux /proc/interrupts shows a device line with per-CPU counts. Likely cause: normal routing, shared IRQs, or a hot device. First safe check: compare the line’s count growth across CPUs.
Interrupt stormObservable signal: one IRQ count rises extremely fast while the system feels sluggish. Likely cause: faulty hardware, bad cable, or a device stuck asserting interrupts. First safe check: disable the device at a safe point or move to another port.
Driver misuseObservable signal: warnings around a driver, crash in an interrupt handler, or a fault after a recent change. Likely cause: bad request_irq() use, wrong flags, or missing cleanup. First safe check: review the handler path and the paired free_irq() call.

How Linux handles interrupts

Linux routes device interrupts through a generic IRQ handling layer that sits between hardware and driver code. It supports multiple interrupt controller hardware types and exposes the standard request, enable, disable, and free APIs. That abstraction is why the same driver model can work across very different platforms. The kernel documentation for generic IRQs describes the framework, while the API docs describe how drivers register and release handlers. [kernel.org: genericirq, request_irq]

Key points: How Linux handles interrupts

Generic IRQ handling layer

An IRQ is an interrupt request from a device, and Linux uses that interrupt line as a kernel identifier for a hardware interrupt source. A single IRQ can be shared by multiple devices, which is why shared IRQs require careful handler logic and a valid device match. You can see live interrupt activity in /proc/interrupts, where each line tracks a source and CPU counts. [kernel.org: genericirq, procfs]

Irq_desc and irq_data.chip

Inside the kernel, each line is tracked by an irq_desc structure. That descriptor stores status information, holds the handle_irq pointer, and references irq_data.chip. Those fields connect the abstract IRQ number to the actual controller and the handler path that processes the event. This is kernel-internal terminology from the generic IRQ subsystem, not a user-space concept. [kernel.org: genericirq]

Flow handlers: edge, level, fasteoi, simple, percpu

Linux picks a flow handler based on the interrupt controller and how the line behaves. Common handlers include handle_level_irq(), handle_edge_irq(), handle_fasteoi_irq(), handle_simple_irq(), and handle_percpu_irq(). The handler choice shapes acknowledgment, masking, and end-of-interrupt behavior. The genericirq documentation uses these flow handlers to explain how the core interrupt code dispatches hardware events. [kernel.org: genericirq]

What is handle_edge_irq in Linux? It is the flow handler used for edge-triggered interrupts, where the kernel must treat a transition as the event, not a sustained signal. If that line reasserts too quickly or is noisy, the same path may fire repeatedly and look like a storm. In other words, the kernel is reacting to transitions, not continuous level assertion. [kernel.org: genericirq]

What request_irq() and friends do

request_irq() asks the kernel to register a handler for a given interrupt line. free_irq() removes it. disable_irq() and enable_irq() turn delivery off and on, and synchronize_irq() waits for in-flight handlers to finish before teardown. These are the core APIs a driver uses to own an interrupt safely. The API reference also documents the shared-IRQ flag behavior, the handler signature, and the expectation that the device and handler agree on ownership. [kernel.org: request_irq, genericirq]

Top half and bottom half work

The top half is the urgent immediate interrupt work. It should be short. The bottom half is deferred work after the interrupt, often handled through softirq-based processing in modern Linux, though the exact deferred mechanism can also involve tasklets or workqueues depending on the subsystem and kernel version. That split lets the kernel acknowledge the device quickly and finish heavier work later, outside the tight interrupt path. [kernel.org: genericirq]

What is the difference between irq and softirq? An IRQ is the hardware-triggered interrupt path that enters the kernel immediately. A softirq is deferred kernel work used after the urgent top half finishes. In practice, IRQ code should be brief, and softirq code handles follow-up tasks that do not need immediate completion. Tasklets are built on softirq machinery, while workqueues run in process context and are appropriate when sleeping may be needed. [kernel.org: genericirq]

What is request_irq used for? It binds a driver’s interrupt handler to a specific IRQ line. Without that registration, the kernel does not know which function should run when the device signals. If the handler is wrong, missing, or registered with the wrong assumptions, the device may misbehave or crash the system. The API also matters for shared interrupts, where the handler must correctly identify whether the device actually caused the interrupt. [kernel.org: request_irq, genericirq]

What irqbalance and affinity change

IRQ affinity controls which CPU handles an interrupt, which matters on multicore systems because hot devices can overload one core while others stay idle. The current placement shows up in the per-CPU columns of /proc/interrupts. irqbalance is a userspace service that helps distribute interrupts across CPUs, but the project docs stress that it is a balancing tool, not a fix for broken hardware or buggy interrupt handlers. [kernel.org: procfs; irqbalance docs]

Reading per-CPU columns in /proc/interrupts

/proc/interrupts lists interrupt sources and per-CPU counts. If one line grows on a single CPU while others stay flat, that interrupt is pinned or concentrated there. If a storage or network IRQ floods one core, affinity tuning may help. If the hardware itself is noisy, affinity changes only hide the symptom. The procfs documentation describes /proc/interrupts as a live kernel accounting view, so treat it as a diagnostic snapshot rather than a static configuration file. [kernel.org: procfs, genericirq]

When irqbalance helps and when it does not

irqbalance helps when a workload is healthy but interrupt load is uneven. It does not fix a bad driver, a broken device, or a platform fault. If a line is generating excessive interrupts because of a hardware error, moving it to another CPU changes placement, not root cause. That distinction is important on modern kernels because balanced delivery is about load distribution, while fault diagnosis still starts with the device, the driver, and the IRQ source. [irqbalance docs; kernel.org: genericirq]

IRQ debug path from device to handler

A useful debug path starts at the device, moves to the IRQ line, then to irq_desc, and finally to the flow handler. That chain shows where the problem sits. If the device asserts the line too often, the kernel sees a storm. If the handler is wrong, the interrupt gets processed badly even though the hardware is fine. This is the most reliable way to interpret an in_irq mention: as a pointer into the interrupt pipeline, not as a standalone error code. [kernel.org: genericirq]

From device interrupt to irq_desc

Suppose a NIC raises an interrupt when packets arrive. The interrupt controller maps that signal to an IRQ number, and Linux looks up the matching irq_desc. The descriptor tells the kernel which handler to call, which chip object controls masking and acknowledgment, and which status flags are active. That mapping is the reason an IRQ number in dmesg can be enough to begin a focused investigation. [kernel.org: genericirq]

From irq_desc to the flow handler

From there, the kernel enters the handler path selected for that line, such as handle_level_irq() or handle_edge_irq(). The handler coordinates delivery, masking, and end-of-interrupt work. The driver’s registered routine runs in interrupt context, which is why in_irq can appear nearby in diagnostics. On shared IRQs, the handler must also verify that its own device actually signaled before doing device-specific work. [kernel.org: genericirq, request_irq]

How to confirm the active CPU and line

Check the interrupt number in the log, then compare it with the matching row in /proc/interrupts. Watch which CPU column increases. If the counts are spread, the line is being steered across cores. If one core absorbs nearly all traffic, affinity or irqbalance may be involved. A practical workflow is: capture the kernel line, identify the IRQ row, check CPU distribution, then decide whether the issue is routing, handler behavior, or hardware noise. [kernel.org: procfs, irqbalance docs]

When the problem is hardware or firmware

Hardware and firmware issues often look like software trouble at first. A bad device, a worn cable, or a controller that keeps signaling can create an interrupt storm. Platform problems can also come from BIOS or UEFI settings that route or mask interrupts poorly. Driver bugs and platform faults can look similar, so separate them carefully. Kernel documentation emphasizes that the interrupt layer is generic, but the actual fault can still sit below it in controller wiring, firmware, or the endpoint device. [kernel.org: genericirq]

Key points: When the problem is hardware or firmware

Signs of a bad device or cable

If the same IRQ count jumps rapidly even when the workload is light, suspect the device path. A loose cable, flaky peripheral, or failing adapter can keep asserting interrupts. A common first-timer mistake is to chase the log text alone and ignore that the counter keeps climbing on one line. That is why /proc/interrupts is such a useful companion to dmesg: it shows whether the source is actively talking to the kernel. [kernel.org: procfs]

Interrupt storms versus handler bugs

An interrupt storm usually shows repeated interrupts from one source, high CPU time, and degraded responsiveness. A handler bug usually appears after a driver change, a module update, or a specific code path in the driver. If the line stays active after the device is disabled, the platform or controller path deserves attention. In the kernel’s own vocabulary, the distinction is between excessive event delivery and incorrect handling in the interrupt callback path. [kernel.org: genericirq, request_irq]

BIOS, UEFI, and platform checks

For end users, the safe checks are practical: update the device driver, update firmware, review BIOS or UEFI settings, and disable unused ports or devices that share a suspect path. Modern systems mitigate conflicts with IRQ sharing and dynamic resource allocation, but that does not replace basic platform hygiene. If the same IRQ assignment reappears after boot, the firmware or board routing may be influencing the interrupt topology. [kernel.org: genericirq; irqbalance docs]

Why linux is important

Linux matters here because it exposes interrupt handling in a way you can inspect. You can see IRQ assignments in /proc/interrupts, inspect affinity, and trace how the generic IRQ layer routes work from hardware to driver. That visibility is useful when a log line says in_irq and you need the real source. It also makes Linux a practical reference point for diagnosing interrupt behavior across kernel versions, including older 4.x systems and current 6.x kernels, where the generic IRQ framework remains the same but subsystem details continue to evolve. [kernel.org: procfs, genericirq]

Why linux is so important

Linux is especially useful for kernel-facing debugging because it separates the interrupt path into named pieces you can verify: the IRQ line, irq_desc, the flow handler, and the driver callback. That structure helps support teams decide whether the symptom points to a driver bug, an interrupt storm, or a platform issue. It also gives you a stable vocabulary for communication, which is why kernel docs and support threads lean on the same terminology. [kernel.org: genericirq, request_irq]

Keep reading

Frequently asked questions

What is linux irq?

A Linux IRQ is an interrupt request from a device, and the kernel uses an IRQ number as an identifier for that hardware source. One IRQ can be shared by multiple devices. You can inspect live counts and CPU placement in /proc/interrupts, which makes it a practical starting point for debugging. [kernel.org: genericirq, procfs]

What does in_irq mean in Linux?

in_irq means code is executing in interrupt context, inside the kernel’s immediate interrupt path rather than normal process context. That matters because interrupt code has tighter limits and usually should not do long work. If you see it in a log, read the nearby driver and IRQ lines first. In kernel documentation terms, this is the hard-IRQ side of the interrupt path, distinct from deferred mechanisms. [kernel.org: genericirq]

How does Linux handle interrupts?

Linux uses a generic IRQ handling layer that maps hardware signals to kernel handlers through irq_desc and a chosen flow handler. Drivers register with request_irq(), then the kernel routes the event to the handler, which performs the urgent top-half work and can defer more work afterward. The architecture is documented in the generic IRQ and API references. [kernel.org: genericirq, request_irq]

What is irq affinity in Linux?

IRQ affinity controls which CPU handles a given interrupt on multicore systems. The effect is visible in the per-CPU columns of /proc/interrupts. Good affinity can spread load more evenly, but it does not cure a faulty device or a buggy interrupt handler. The value is in balancing delivery, not in replacing root-cause analysis. [kernel.org: procfs, irqbalance docs]

What is irqbalance in Linux?

irqbalance is a userspace service that helps distribute interrupts across CPUs. It is relevant when interrupt load is uneven and the hardware is healthy. It is not a fix for bad driver code, a broken peripheral, or a platform fault that keeps generating interrupts. The project documentation positions it as an automated balancing aid, not a universal repair tool. [irqbalance docs]

How do I check interrupts in Linux?

Start with /proc/interrupts and watch which lines increase and on which CPUs. Then compare those counts with recent kernel log lines and the driver involved. If the counts spike on one line, that device or its handler is a strong candidate. If the system is crashing, capture the exact log context before changing settings. For example, a live /proc/interrupts row may look like a device name followed by per-CPU counters that continue to grow on one column, which is the clue that affinity or device behavior needs attention. [kernel.org: procfs, genericirq]

How do I diagnose this as a support workflow?

Use a short workflow: first capture the exact dmesg line and the surrounding lines; second match any IRQ number to /proc/interrupts; third decide whether the issue is a shared IRQ, a hot device, or a handler bug; fourth check driver and firmware changes; fifth only then consider affinity tuning or irqbalance. That sequence keeps Windows crash terms, Linux interrupt terms, and hardware faults separated cleanly. [kernel.org: genericirq, procfs, request_irq; irqbalance docs]

What does handle_edge_irq do?

handle_edge_irq() is the kernel’s flow handler for edge-triggered interrupts. It processes a transition event rather than a sustained signal, so repeated edges or noisy hardware can make the same line fire repeatedly. That is why edge-triggered sources are often a focus during interrupt-storm triage. [kernel.org: genericirq]

What is request_irq in the kernel?

request_irq() registers an interrupt handler with the kernel and assigns it to a specific IRQ number. The function is central to driver bring-up because it establishes ownership, handler identity, and shared-IRQ behavior. If the handler registration is wrong, the device may never be serviced correctly or may interfere with other devices sharing the line. [kernel.org: request_irq, genericirq]

What is the difference between irq and softirq in Linux?

An IRQ is the immediate hardware interrupt path. A softirq is deferred kernel work that runs after the urgent top-half processing. On modern Linux, the exact deferred mechanism can vary by subsystem, so it is safer to say that Linux uses softirq-based processing for many deferred tasks rather than claiming every driver uses only one mechanism. Tasklets are built on softirqs, while workqueues run in process context. [kernel.org: genericirq]

Sources

  • Linux kernel documentation, generic IRQ handling and flow handlers: kernel.org documentation for the generic IRQ subsystem.
  • Linux kernel API reference for request_irq(), free_irq(), disable_irq(), enable_irq(), and synchronize_irq().
  • Linux procfs documentation for /proc/interrupts and other interrupt-related kernel interfaces.
  • irqbalance project documentation for CPU affinity balancing behavior and scope.

Similar Posts