scripts/gdb/linux/interrupts.py
Source file repositories/reference/linux-study-clean/scripts/gdb/linux/interrupts.py
File Facts
- System
- Linux kernel
- Corpus path
scripts/gdb/linux/interrupts.py- Extension
.py- Size
- 6120 bytes
- Lines
- 201
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: scripts
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
# SPDX-License-Identifier: GPL-2.0
#
# Copyright 2023 Broadcom
import gdb
from linux import constants
from linux import cpus
from linux import utils
from linux import mapletree
irq_desc_type = utils.CachedType("struct irq_desc")
def irq_settings_is_hidden(desc):
return desc['status_use_accessors'] & constants.LX_IRQ_HIDDEN
def irq_desc_is_chained(desc):
return desc['action'] and desc['action'] == gdb.parse_and_eval("&chained_action")
def irqd_is_level(desc):
return desc['irq_data']['common']['state_use_accessors'] & constants.LX_IRQD_LEVEL
def show_irq_desc(prec, chip_width, irq):
text = ""
desc = mapletree.mtree_load(gdb.parse_and_eval("&sparse_irqs"), irq)
if desc is None:
return text
desc = desc.cast(irq_desc_type.get_type().pointer())
if desc == 0:
return text
if irq_settings_is_hidden(desc):
return text
any_count = 0
if desc['kstat_irqs']:
for cpu in cpus.each_online_cpu():
any_count += cpus.per_cpu(desc['kstat_irqs'], cpu)['cnt']
if (desc['action'] == 0 or irq_desc_is_chained(desc)) and any_count == 0:
return text;
text += "%*d: " % (prec, irq)
for cpu in cpus.each_online_cpu():
if desc['kstat_irqs']:
count = cpus.per_cpu(desc['kstat_irqs'], cpu)['cnt']
else:
count = 0
text += "%10u " % (count)
name = "None"
if desc['irq_data']['chip']:
chip = desc['irq_data']['chip']
if chip['name']:
name = chip['name'].string()
else:
name = "-"
text += " %-*s" % (chip_width, name)
if desc['irq_data']['domain']:
text += " %*lu" % (prec, desc['irq_data']['hwirq'])
else:
text += " %*s" % (prec, "")
if constants.LX_CONFIG_GENERIC_IRQ_SHOW_LEVEL:
text += " %-8s" % ("Level" if irqd_is_level(desc) else "Edge")
Annotation
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: atlas-only.
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.