From: Thomas Gleixner <tglx@kernel.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org, Michael Kelley <mhklinux@outlook.com>,
Dmitry Ilvokhin <d@ilvokhin.com>, Radu Rendec <radu@rendec.net>,
Jan Kiszka <jan.kiszka@siemens.com>,
Kieran Bingham <kbingham@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Marc Zyngier <maz@kernel.org>
Subject: [patch V4 07/15] scripts/gdb: Update x86 interrupts to the array based storage
Date: Tue, 31 Mar 2026 09:26:01 +0200 [thread overview]
Message-ID: <20260331072419.015247250@kernel.org> (raw)
In-Reply-To: 20260331071453.172185305@kernel.org
From: Thomas Gleixner <tglx@kernel.org>
x86 changed the interrupt statistics from a struct with individual members
to an counter array. It also provides a corresponding info array with the
strings for prefix and description and an indicator to skip the entry.
Update the already out of sync GDB script to use the counter and the info
array, which keeps the GDB script in sync automatically.
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
V4: Adopted to irq_stat_count_show bitmap and removed the duplicate ERR/MIS output
V3: New patch - Radu
---
scripts/gdb/linux/interrupts.py | 74 ++++++++--------------------------------
1 file changed, 16 insertions(+), 58 deletions(-)
--- a/scripts/gdb/linux/interrupts.py
+++ b/scripts/gdb/linux/interrupts.py
@@ -90,71 +90,29 @@ irq_desc_type = utils.CachedType("struct
return text
-def show_irq_err_count(prec):
- cnt = utils.gdb_eval_or_none("irq_err_count")
- text = ""
- if cnt is not None:
- text += "%*s: %10u\n" % (prec, "ERR", cnt['counter'])
- return text
-
-def x86_show_irqstat(prec, pfx, field, desc):
- irq_stat = gdb.parse_and_eval("&irq_stat")
+def x86_show_irqstat(prec, pfx, idx, desc):
+ irq_stat = gdb.parse_and_eval("&irq_stat.counts[%d]" %idx)
text = "%*s: " % (prec, pfx)
for cpu in cpus.each_online_cpu():
stat = cpus.per_cpu(irq_stat, cpu)
- text += "%10u " % (stat[field])
- text += " %s\n" % (desc)
- return text
-
-def x86_show_mce(prec, var, pfx, desc):
- pvar = gdb.parse_and_eval(var)
- text = "%*s: " % (prec, pfx)
- for cpu in cpus.each_online_cpu():
- text += "%10u " % (cpus.per_cpu(pvar, cpu).dereference())
- text += " %s\n" % (desc)
+ text += "%10u " % (stat.dereference())
+ text += desc
return text
def x86_show_interupts(prec):
- text = x86_show_irqstat(prec, "NMI", '__nmi_count', 'Non-maskable interrupts')
+ info_type = gdb.lookup_type('struct irq_stat_info')
+ info = gdb.parse_and_eval('irq_stat_info')
+ bitmap = gdb.parse_and_eval('irq_stat_count_show')
+ nbits = 8 * int(bitmap.type.sizeof)
- if constants.LX_CONFIG_X86_LOCAL_APIC:
- text += x86_show_irqstat(prec, "LOC", 'apic_timer_irqs', "Local timer interrupts")
- text += x86_show_irqstat(prec, "SPU", 'irq_spurious_count', "Spurious interrupts")
- text += x86_show_irqstat(prec, "PMI", 'apic_perf_irqs', "Performance monitoring interrupts")
- text += x86_show_irqstat(prec, "IWI", 'apic_irq_work_irqs', "IRQ work interrupts")
- text += x86_show_irqstat(prec, "RTR", 'icr_read_retry_count', "APIC ICR read retries")
- if utils.gdb_eval_or_none("x86_platform_ipi_callback") is not None:
- text += x86_show_irqstat(prec, "PLT", 'x86_platform_ipis', "Platform interrupts")
-
- if constants.LX_CONFIG_SMP:
- text += x86_show_irqstat(prec, "RES", 'irq_resched_count', "Rescheduling interrupts")
- text += x86_show_irqstat(prec, "CAL", 'irq_call_count', "Function call interrupts")
- text += x86_show_irqstat(prec, "TLB", 'irq_tlb_count', "TLB shootdowns")
-
- if constants.LX_CONFIG_X86_THERMAL_VECTOR:
- text += x86_show_irqstat(prec, "TRM", 'irq_thermal_count', "Thermal events interrupts")
-
- if constants.LX_CONFIG_X86_MCE_THRESHOLD:
- text += x86_show_irqstat(prec, "THR", 'irq_threshold_count', "Threshold APIC interrupts")
-
- if constants.LX_CONFIG_X86_MCE_AMD:
- text += x86_show_irqstat(prec, "DFR", 'irq_deferred_error_count', "Deferred Error APIC interrupts")
-
- if constants.LX_CONFIG_X86_MCE:
- text += x86_show_mce(prec, "&mce_exception_count", "MCE", "Machine check exceptions")
- text += x86_show_mce(prec, "&mce_poll_count", "MCP", "Machine check polls")
-
- text += show_irq_err_count(prec)
-
- if constants.LX_CONFIG_X86_IO_APIC:
- cnt = utils.gdb_eval_or_none("irq_mis_count")
- if cnt is not None:
- text += "%*s: %10u\n" % (prec, "MIS", cnt['counter'])
-
- if constants.LX_CONFIG_KVM:
- text += x86_show_irqstat(prec, "PIN", 'kvm_posted_intr_ipis', 'Posted-interrupt notification event')
- text += x86_show_irqstat(prec, "NPI", 'kvm_posted_intr_nested_ipis', 'Nested posted-interrupt event')
- text += x86_show_irqstat(prec, "PIW", 'kvm_posted_intr_wakeup_ipis', 'Posted-interrupt wakeup event')
+ text = ""
+ for idx in range(int(info.type.sizeof / info_type.sizeof)):
+ show = bitmap[idx / nbits]
+ if not show & 1 << (idx % nbits):
+ continue
+ pfx = info[idx]['symbol'].string()
+ desc = info[idx]['text'].string()
+ text += x86_show_irqstat(prec, pfx, idx, desc)
return text
next prev parent reply other threads:[~2026-03-31 7:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 7:25 [patch V4 00/15] Improve /proc/interrupts further Thomas Gleixner
2026-03-31 7:25 ` [patch V4 01/15] x86/irq: Optimize interrupts decimals printing Thomas Gleixner
2026-03-31 7:25 ` [patch V4 02/15] genirq/proc: Avoid formatting zero counts in /proc/interrupts Thomas Gleixner
2026-03-31 7:25 ` [patch V4 03/15] genirq/proc: Utilize irq_desc::tot_count to avoid evaluation Thomas Gleixner
2026-03-31 7:25 ` [patch V4 04/15] x86/irq: Make irqstats array based Thomas Gleixner
2026-03-31 14:45 ` Thomas Gleixner
2026-03-31 7:25 ` [patch V4 05/15] x86/irq: Suppress unlikely interrupt stats by default Thomas Gleixner
2026-03-31 21:12 ` Radu Rendec
2026-03-31 7:25 ` [patch V4 06/15] x86/irq: Move IOAPIC misrouted and PIC/APIC error counts into irq_stats Thomas Gleixner
2026-03-31 21:40 ` Radu Rendec
2026-03-31 7:26 ` Thomas Gleixner [this message]
2026-03-31 14:47 ` [patch V4 07/15] scripts/gdb: Update x86 interrupts to the array based storage Thomas Gleixner
2026-03-31 7:26 ` [patch V4 08/15] genirq: Expose nr_irqs in core code Thomas Gleixner
2026-03-31 7:26 ` [patch V4 09/15] genirq/manage: Make NMI cleanup RT safe Thomas Gleixner
2026-03-31 7:26 ` [patch V4 10/15] genirq: Cache the condition for /proc/interrupts exposure Thomas Gleixner
2026-03-31 7:26 ` [patch V4 11/15] genirq: Calculate precision only when required Thomas Gleixner
2026-03-31 7:26 ` [patch V4 12/15] genirq: Add rcuref count to struct irq_desc Thomas Gleixner
2026-03-31 7:26 ` [patch V4 13/15] genirq: Expose irq_find_desc_at_or_after() in core code Thomas Gleixner
2026-03-31 13:48 ` Dmitry Ilvokhin
2026-03-31 7:26 ` [patch V4 14/15] genirq/proc: Runtime size the chip name Thomas Gleixner
2026-03-31 14:22 ` Dmitry Ilvokhin
2026-03-31 7:26 ` [patch V4 15/15] genirq/proc: Speed up /proc/interrupts iteration Thomas Gleixner
2026-03-31 16:04 ` Dmitry Ilvokhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260331072419.015247250@kernel.org \
--to=tglx@kernel.org \
--cc=d@ilvokhin.com \
--cc=florian.fainelli@broadcom.com \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=mhklinux@outlook.com \
--cc=radu@rendec.net \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox