arch/um/kernel/irq.c
Source file repositories/reference/linux-study-clean/arch/um/kernel/irq.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/kernel/irq.c- Extension
.c- Size
- 16372 bytes
- Lines
- 729
- Domain
- Architecture Layer
- Bucket
- arch/um
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpumask.hlinux/hardirq.hlinux/interrupt.hlinux/kernel_stat.hlinux/module.hlinux/sched.hlinux/seq_file.hlinux/slab.has-layout.hkern_util.hos.hirq_user.hirq_kern.hlinux/time-internal.h
Detected Declarations
struct irq_regstruct irq_entryfunction irq_io_loopfunction irq_event_handlerfunction irq_do_timetravel_handlerfunction irq_do_pending_eventsfunction list_for_each_entryfunction irq_do_timetravel_handlerfunction irq_do_pending_eventsfunction pendingfunction _sigio_handlerfunction sigio_handlerfunction list_for_each_entryfunction remove_irq_entryfunction update_irq_entryfunction activate_fdfunction um_free_irqfunction free_irq_by_irq_and_devfunction deactivate_fdfunction deactivate_all_fdsfunction IRQsfunction um_free_irqfunction _um_request_irqfunction um_request_irqfunction um_request_irq_ttfunction sigio_run_timetravel_handlersfunction um_irqs_suspendfunction um_irqs_resumefunction normal_irq_set_wakefunction dummyfunction init_IRQfunction arch_probe_nr_irqsfunction sigchld_handlerfunction arch_show_interruptsexport free_irq_by_fdexport deactivate_fdexport um_free_irqexport um_request_irqexport um_request_irq_tt
Annotated Snippet
struct irq_reg {
void *id;
int irq;
/* it's cheaper to store this than to query it */
int events;
bool active;
bool pending;
bool wakeup;
#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT
bool pending_event;
void (*timetravel_handler)(int, int, void *,
struct time_travel_event *);
struct time_travel_event event;
#endif
};
struct irq_entry {
struct list_head list;
int fd;
struct irq_reg reg[NUM_IRQ_TYPES];
bool suspended;
bool sigio_workaround;
};
static DEFINE_RAW_SPINLOCK(irq_lock);
static LIST_HEAD(active_fds);
static DECLARE_BITMAP(irqs_allocated, UM_LAST_SIGNAL_IRQ);
static bool irqs_suspended;
#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT
static bool irqs_pending;
#endif
static void irq_io_loop(struct irq_reg *irq, struct uml_pt_regs *regs)
{
/*
* irq->active guards against reentry
* irq->pending accumulates pending requests
* if pending is raised the irq_handler is re-run
* until pending is cleared
*/
if (irq->active) {
irq->active = false;
do {
irq->pending = false;
do_IRQ(irq->irq, regs);
} while (irq->pending);
irq->active = true;
} else {
irq->pending = true;
}
}
#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT
static void irq_event_handler(struct time_travel_event *ev)
{
struct irq_reg *reg = container_of(ev, struct irq_reg, event);
/* do nothing if suspended; just cause a wakeup and mark as pending */
if (irqs_suspended) {
irqs_pending = true;
reg->pending_event = true;
return;
}
generic_handle_irq(reg->irq);
}
static bool irq_do_timetravel_handler(struct irq_entry *entry,
enum um_irq_type t)
{
struct irq_reg *reg = &entry->reg[t];
if (!reg->timetravel_handler)
return false;
/*
* Handle all messages - we might get multiple even while
* interrupts are already suspended, due to suspend order
* etc. Note that time_travel_add_irq_event() will not add
* an event twice, if it's pending already "first wins".
*/
reg->timetravel_handler(reg->irq, entry->fd, reg->id, ®->event);
if (!reg->event.pending)
return false;
return true;
}
Annotation
- Immediate include surface: `linux/cpumask.h`, `linux/hardirq.h`, `linux/interrupt.h`, `linux/kernel_stat.h`, `linux/module.h`, `linux/sched.h`, `linux/seq_file.h`, `linux/slab.h`.
- Detected declarations: `struct irq_reg`, `struct irq_entry`, `function irq_io_loop`, `function irq_event_handler`, `function irq_do_timetravel_handler`, `function irq_do_pending_events`, `function list_for_each_entry`, `function irq_do_timetravel_handler`, `function irq_do_pending_events`, `function pending`.
- Atlas domain: Architecture Layer / arch/um.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.