Skip to contentSkip to conversation

irqchip/gic-v5: Remove undue WARN_ON()s in the IRS affinity parsing

PATCH Applied Lorenzo Pieralisi 2 participants 2 messages Aug 14, 2025 – Aug 24, 2025

Subsystems (3)
lore
Share & tools
lore

Lorenzo Pieralisi

author maintainer
#0 lore raw

PATCH 1/1 irqchip/gic-v5: Remove undue WARN_ON()s in the IRS affinity parsing

In gicv5_irs_of_init_affinity() a WARN_ON() is triggered if:

(1) a phandle in the "cpus" property does not correspond to a valid OF node
(2) a cpu logical id does not exist for a given OF cpu_node

(1) is a firmware bug and should be reported as such but does not grant a WARN_ON() backtrace.

(2) is not necessarily an error condition (eg a kernel can be booted with nr_cpus=X limiting the number of cores artificially) and therefore there is no reason to clutter the kernel log with WARN_ON() output when the condition is hit.

Rework the IRS affinity parsing code to remove undue WARN_ON()s thus making it less noisy.

Cc Thomas Gleixner <[email protected]>
Cc Marc Zyngier <[email protected]>
---
 drivers/irqchip/irq-gic-v5-irs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/irqchip/irq-gic-v5-irs.c +4 -2
index e8a576f66366..ce2732d649a3 100644
@@ -626,12 +626,14 @@ static int __init gicv5_irs_of_init_affinity(struct device_node *node,
 		int cpu;
 
 		cpu_node = of_parse_phandle(node, "cpus", i);
-		if (WARN_ON(!cpu_node))
+		if (!cpu_node) {
+			pr_warn(FW_BUG "Erroneous CPU node phandle\n");
 			continue;
+		}
 
 		cpu = of_cpu_node_to_id(cpu_node);
 		of_node_put(cpu_node);
-		if (WARN_ON(cpu < 0))
+		if (cpu < 0)
 			continue;
 
 		if (iaffids[i] & ~iaffid_mask) {
Signature · 1 line
2.48.0
#1 lore raw
The following commit has been merged into the irq/urgent branch of tip:

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     35c23871be0072738ccc7ca00354c791711e5640
Gitweb:        https://git.kernel.org/tip/35c23871be0072738ccc7ca00354c791711e5640
Author:        Lorenzo Pieralisi <[email protected]>
AuthorDate:    Thu, 14 Aug 2025 11:41:38 +02:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Sun, 24 Aug 2025 12:54:06 +02:00

irqchip/gic-v5: Remove undue WARN_ON()s in the IRS affinity parsing

In gicv5_irs_of_init_affinity() a WARN_ON() is triggered if:

1) a phandle in the "cpus" property does not correspond to a valid OF node
2 a CPU logical id does not exist for a given OF cpu_node

#1 is a firmware bug and should be reported as such but does not warrant a
WARN_ON() backtrace.

#2 is not necessarily an error condition (eg a kernel can be booted with
nr_cpus=X limiting the number of cores artificially) and therefore there is no reason to clutter the kernel log with WARN_ON() output when the condition is hit.

Rework the IRS affinity parsing code to remove undue WARN_ON()s thus making it less noisy.

---
 drivers/irqchip/irq-gic-v5-irs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/irqchip/irq-gic-v5-irs.c +4 -2
index ffc9773..13c0357 100644
@@ -626,12 +626,14 @@ static int __init gicv5_irs_of_init_affinity(struct device_node *node,
 		int cpu;
 
 		cpu_node = of_parse_phandle(node, "cpus", i);
-		if (WARN_ON(!cpu_node))
+		if (!cpu_node) {
+			pr_warn(FW_BUG "Erroneous CPU node phandle\n");
 			continue;
+		}
 
 		cpu = of_cpu_node_to_id(cpu_node);
 		of_node_put(cpu_node);
-		if (WARN_ON(cpu < 0))
+		if (cpu < 0)
 			continue;
 
 		if (iaffids[i] & ~iaffid_mask) {