From nobody Mon Jun 8 20:53:22 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED50D4014A9; Tue, 26 May 2026 14:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779805357; cv=none; b=A2HqctDdqd9Kt5ZCfgmyy3VRQVwINVa05YoVYcKAvrJu/o1IWqNC6dEhQz9KXyJpg0BK/gRnTFAO5gokA1rJKkhYkr299FUQLukmP00hiG145pyZbqpJIts565G7vRgmA1lTPfndQDwfudpmDJIvFnwdyUvYj6H8QOjlzmmSLso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779805357; c=relaxed/simple; bh=kEovX0/W+SUGsevMm20mVSp+t184su73+d8CUFzj+Lw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=SFi0jQ5izmkQN9hgsUv/bjlEnSyTrNpfcoNEwvrsJg8lm5ITruQ+ICfW4eSNQNVX4XjhsfhnCeGAAR0T+Y01nc0faFEQDN9B67yLAoZGOy/hedEMZx6apIfiA4ZbH3JdT516PlY/XNv59KV20m0Z/obyckALCVebUPxkWOVcLHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2nUIN4EG; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UGe2TkBu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2nUIN4EG"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UGe2TkBu" Date: Tue, 26 May 2026 14:22:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779805350; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j7jqVFobUgz3OWMjwjrI+LhQyAPEjvCslHkLlpzYeWE=; b=2nUIN4EGZnWlrM2gsqKGa8Ae5ZO14G22UZklGOTRjJ3ydAQcooQjRxwGXoS7BHH4BK5Zv3 fjL3wWre706uI9OPWcFK2FIVTqa7gkiDECyC0eBhcMQl5XOGSeFFyG4ItlqD8bvZcvwFB9 wXaG9Gt7ekdpkyPFyjX4kXP97pPq585sYEzxzi1wCr5urV7WJcyYP9hD4j0Qr/ZH9GdEkr lTE5yuXsaGbf0osNp13z1l2BO4WlJEgO+0zC2hYt1kH35ICCiN3dbCS6KnyrZx0nXwwQ0O wIJqt4OULOdrwsPPwsEtbQEbwuGNwt3PRm5W0HLv9STdagUftLBnUKjJKDFseA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779805350; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j7jqVFobUgz3OWMjwjrI+LhQyAPEjvCslHkLlpzYeWE=; b=UGe2TkBufC4Wxrb97r0c+63Bkz3SiTdxQAm49RXxq4JcIONxkEZeUbqT0TBoqHrLx8otBv Dq26BnleQVt+VSDA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq: Expose nr_irqs in core code Cc: Thomas Gleixner , Michael Kelley , Dmitry Ilvokhin , Radu Rendec , Shrikanth Hegde , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20260517194931.522168332@kernel.org> References: <20260517194931.522168332@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177980534920.1039918.628814386883299708.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the irq/core branch of tip: Commit-ID: b99dc723b12ea587fc8b2e07bd8401433eec58d8 Gitweb: https://git.kernel.org/tip/b99dc723b12ea587fc8b2e07bd8401433= eec58d8 Author: Thomas Gleixner AuthorDate: Sun, 17 May 2026 22:02:09 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 26 May 2026 16:21:13 +02:00 genirq: Expose nr_irqs in core code ... to avoid function calls in the core code to retrieve the maximum number of interrupts. Rename it to 'total_nr_irqs' as 'nr_irqs' is too generic and fix up the 'nr_irqs' reference in the related GDB script as well. Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Reviewed-by: Dmitry Ilvokhin Reviewed-by: Radu Rendec Reviewed-by: Shrikanth Hegde Link: https://patch.msgid.link/20260517194931.522168332@kernel.org --- kernel/irq/internals.h | 1 + kernel/irq/irqdesc.c | 28 ++++++++++++++-------------- kernel/irq/proc.c | 4 ++-- scripts/gdb/linux/interrupts.py | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 9412e57..db359ac 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -21,6 +21,7 @@ =20 extern bool noirqdebug; extern int irq_poll_cpu; +extern unsigned int total_nr_irqs; =20 extern struct irqaction chained_action; =20 diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 7173b8b..a7ce1e8 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -140,14 +140,14 @@ static void desc_set_defaults(unsigned int irq, struc= t irq_desc *desc, int node, desc_smp_init(desc, node, affinity); } =20 -static unsigned int nr_irqs =3D NR_IRQS; +unsigned int total_nr_irqs __read_mostly =3D NR_IRQS; =20 /** * irq_get_nr_irqs() - Number of interrupts supported by the system. */ unsigned int irq_get_nr_irqs(void) { - return nr_irqs; + return total_nr_irqs; } EXPORT_SYMBOL_GPL(irq_get_nr_irqs); =20 @@ -159,7 +159,7 @@ EXPORT_SYMBOL_GPL(irq_get_nr_irqs); */ unsigned int irq_set_nr_irqs(unsigned int nr) { - nr_irqs =3D nr; + total_nr_irqs =3D nr; =20 return nr; } @@ -187,9 +187,9 @@ static unsigned int irq_find_at_or_after(unsigned int o= ffset) struct irq_desc *desc; =20 guard(rcu)(); - desc =3D mt_find(&sparse_irqs, &index, nr_irqs); + desc =3D mt_find(&sparse_irqs, &index, total_nr_irqs); =20 - return desc ? irq_desc_get_irq(desc) : nr_irqs; + return desc ? irq_desc_get_irq(desc) : total_nr_irqs; } =20 static void irq_insert_desc(unsigned int irq, struct irq_desc *desc) @@ -543,7 +543,7 @@ static bool irq_expand_nr_irqs(unsigned int nr) { if (nr > MAX_SPARSE_IRQS) return false; - nr_irqs =3D nr; + total_nr_irqs =3D nr; return true; } =20 @@ -557,16 +557,16 @@ int __init early_irq_init(void) /* Let arch update nr_irqs and return the nr of preallocated irqs */ initcnt =3D arch_probe_nr_irqs(); printk(KERN_INFO "NR_IRQS: %d, nr_irqs: %d, preallocated irqs: %d\n", - NR_IRQS, nr_irqs, initcnt); + NR_IRQS, total_nr_irqs, initcnt); =20 - if (WARN_ON(nr_irqs > MAX_SPARSE_IRQS)) - nr_irqs =3D MAX_SPARSE_IRQS; + if (WARN_ON(total_nr_irqs > MAX_SPARSE_IRQS)) + total_nr_irqs =3D MAX_SPARSE_IRQS; =20 if (WARN_ON(initcnt > MAX_SPARSE_IRQS)) initcnt =3D MAX_SPARSE_IRQS; =20 - if (initcnt > nr_irqs) - nr_irqs =3D initcnt; + if (initcnt > total_nr_irqs) + total_nr_irqs =3D initcnt; =20 for (i =3D 0; i < initcnt; i++) { desc =3D alloc_desc(i, node, 0, NULL, NULL); @@ -862,7 +862,7 @@ void irq_free_descs(unsigned int from, unsigned int cnt) { int i; =20 - if (from >=3D nr_irqs || (from + cnt) > nr_irqs) + if (from >=3D total_nr_irqs || (from + cnt) > total_nr_irqs) return; =20 guard(mutex)(&sparse_irq_lock); @@ -911,7 +911,7 @@ int __ref __irq_alloc_descs(int irq, unsigned int from,= unsigned int cnt, int no if (irq >=3D0 && start !=3D irq) return -EEXIST; =20 - if (start + cnt > nr_irqs) { + if (start + cnt > total_nr_irqs) { if (!irq_expand_nr_irqs(start + cnt)) return -ENOMEM; } @@ -923,7 +923,7 @@ EXPORT_SYMBOL_GPL(__irq_alloc_descs); * irq_get_next_irq - get next allocated irq number * @offset: where to start the search * - * Returns next irq number after offset or nr_irqs if none is found. + * Returns next irq number after offset or total_nr_irqs if none is found. */ unsigned int irq_get_next_irq(unsigned int offset) { diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 5a1805b..d5b8126 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -448,7 +448,7 @@ int __weak arch_show_interrupts(struct seq_file *p, int= prec) } =20 #ifndef ACTUAL_NR_IRQS -# define ACTUAL_NR_IRQS irq_get_nr_irqs() +# define ACTUAL_NR_IRQS total_nr_irqs #endif =20 /* Same as seq_put_decimal_ull_width(p, " ", cnt, 10) */ @@ -490,7 +490,7 @@ void irq_proc_emit_counts(struct seq_file *p, unsigned = int __percpu *cnts) =20 int show_interrupts(struct seq_file *p, void *v) { - const unsigned int nr_irqs =3D irq_get_nr_irqs(); + const unsigned int nr_irqs =3D total_nr_irqs; static int prec; =20 int i =3D *(loff_t *) v, j; diff --git a/scripts/gdb/linux/interrupts.py b/scripts/gdb/linux/interrupts= .py index b794e01..a4e25d2 100644 --- a/scripts/gdb/linux/interrupts.py +++ b/scripts/gdb/linux/interrupts.py @@ -174,7 +174,7 @@ class LxInterruptList(gdb.Command): super(LxInterruptList, self).__init__("lx-interruptlist", gdb.COMM= AND_DATA) =20 def invoke(self, arg, from_tty): - nr_irqs =3D gdb.parse_and_eval("nr_irqs") + nr_irqs =3D gdb.parse_and_eval("total_nr_irqs") prec =3D 3 j =3D 1000 while prec < 10 and j <=3D nr_irqs: