public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 V5 00/15] Improve /proc/interrupts further
Date: Wed, 01 Apr 2026 23:51:28 +0200	[thread overview]
Message-ID: <20260401195625.213446764@kernel.org> (raw)

This is a follow up to v4 which can be found here:

  https://lore.kernel.org/20260331071453.172185305@kernel.org

The v1 cover letter contains a full analysis, explanation and numbers:

  https://lore.kernel.org/20260303150539.513068586@kernel.org

TLDR:

  - The performance of reading of /proc/interrupts has been improved
    piecewise over the years, but most of the low hanging fruit has been
    left on the table.

Changes vs. V4:

  - Moved the header printing ahead of the architecture and update comment
    - Dmitry

  - Fix the gdbscript so it works with a bitmap larger than one entry and
    bring show_irq_err_count() back as it's required by MIPS

  - Removed unused variable and resort hunks so it's bisectable.

Delta patch against v4 is below.

The series applies on top of v7.0-rc3 and is also available via git:

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git irq-proc-v5

Thanks,

	tglx
---
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index ae8b06e01948..7eb07e3bdb4c 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -2066,7 +2066,6 @@ static const void *__cleanup_nmi(unsigned int irq, struct irq_desc *desc)
 const void *free_nmi(unsigned int irq, void *dev_id)
 {
 	struct irq_desc *desc = irq_to_desc(irq);
-	void *ret;
 
 	if (!desc || WARN_ON(!irq_is_nmi(desc)))
 		return NULL;
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index a62d4694f063..3bd394aa7617 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -540,10 +540,7 @@ static int irq_seq_show(struct seq_file *p, void *v)
 	struct irq_desc *desc = v;
 	struct irqaction *action;
 
-	if (desc == ARCH_PROC_IRQDESC)
-		return arch_show_interrupts(p, constr->num_prec);
-
-	/* print header for the first interrupt indicated by !p>private */
+	/* Print header for the first interrupt? */
 	if (constr->print_header) {
 		unsigned int cpu;
 
@@ -554,6 +551,9 @@ static int irq_seq_show(struct seq_file *p, void *v)
 		constr->print_header = false;
 	}
 
+	if (desc == ARCH_PROC_IRQDESC)
+		return arch_show_interrupts(p, constr->num_prec);
+
 	seq_put_decimal_ull_width(p, "", irq_desc_get_irq(desc), constr->num_prec);
 	seq_putc(p, ':');
 
@@ -617,9 +617,9 @@ static void *irq_seq_next_desc(loff_t *pos)
 		if (desc) {
 			*pos = irq_desc_get_irq(desc);
 			/*
-			 * If valid for output try to acquire a reference count
-			 * on the descriptor so that it can't be freed after
-			 * dropping RCU read lock on return.
+			 * If valid for output then try to acquire a reference
+			 * count on the descriptor so that it can't be freed
+			 * after dropping RCU read lock on return.
 			 */
 			if (irq_settings_proc_valid(desc) && irq_desc_get_ref(desc))
 				return desc;
diff --git a/scripts/gdb/linux/interrupts.py b/scripts/gdb/linux/interrupts.py
index 418f3ece2f0f..cf0a02c8124d 100644
--- a/scripts/gdb/linux/interrupts.py
+++ b/scripts/gdb/linux/interrupts.py
@@ -103,12 +103,12 @@ def x86_show_interupts(prec):
     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)
+    bitsperlong = 8 * int(bitmap.type.target().sizeof)
 
     text = ""
     for idx in range(int(info.type.sizeof / info_type.sizeof)):
-        show = bitmap[idx / nbits]
-        if not show & 1 << (idx % nbits):
+        show = bitmap[int(idx / bitsperlong)]
+        if not show & 1 << int(idx % bitsperlong):
             continue
         pfx = info[idx]['symbol'].string()
         desc = info[idx]['text'].string()
@@ -145,6 +145,13 @@ def aarch64_show_interrupts(prec):
     text += "%*s: %10lu\n" % (prec, "ERR", gdb.parse_and_eval("irq_err_count"))
     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 arch_show_interrupts(prec):
     text = ""
     if utils.is_target_arch("x86"):

             reply	other threads:[~2026-04-01 21:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 21:51 Thomas Gleixner [this message]
2026-04-01 21:51 ` [patch V5 01/15] x86/irq: Optimize interrupts decimals printing Thomas Gleixner
2026-04-01 21:51 ` [patch V5 02/15] genirq/proc: Avoid formatting zero counts in /proc/interrupts Thomas Gleixner
2026-04-01 21:51 ` [patch V5 03/15] genirq/proc: Utilize irq_desc::tot_count to avoid evaluation Thomas Gleixner
2026-04-01 21:51 ` [patch V5 04/15] x86/irq: Make irqstats array based Thomas Gleixner
2026-04-01 21:51 ` [patch V5 05/15] x86/irq: Suppress unlikely interrupt stats by default Thomas Gleixner
2026-04-02 16:39   ` Radu Rendec
2026-04-01 21:52 ` [patch V5 06/15] x86/irq: Move IOAPIC misrouted and PIC/APIC error counts into irq_stats Thomas Gleixner
2026-04-02 16:41   ` Radu Rendec
2026-04-01 21:52 ` [patch V5 07/15] scripts/gdb: Update x86 interrupts to the array based storage Thomas Gleixner
2026-04-02 17:11   ` Radu Rendec
2026-04-01 21:52 ` [patch V5 08/15] genirq: Expose nr_irqs in core code Thomas Gleixner
2026-04-01 21:52 ` [patch V5 09/15] genirq/manage: Make NMI cleanup RT safe Thomas Gleixner
2026-04-01 21:52 ` [patch V5 10/15] genirq: Cache the condition for /proc/interrupts exposure Thomas Gleixner
2026-04-02 17:27   ` Radu Rendec
2026-04-01 21:52 ` [patch V5 11/15] genirq: Calculate precision only when required Thomas Gleixner
2026-04-01 21:52 ` [patch V5 12/15] genirq: Add rcuref count to struct irq_desc Thomas Gleixner
2026-04-01 21:52 ` [patch V5 13/15] genirq: Expose irq_find_desc_at_or_after() in core code Thomas Gleixner
2026-04-01 21:52 ` [patch V5 14/15] genirq/proc: Runtime size the chip name Thomas Gleixner
2026-04-01 21:52 ` [patch V5 15/15] genirq/proc: Speed up /proc/interrupts iteration Thomas Gleixner
2026-04-02  2:32 ` [patch V5 00/15] Improve /proc/interrupts further Michael Kelley
2026-04-02 13:46   ` Thomas Gleixner

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=20260401195625.213446764@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