mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq: Discard cpumask of irqaffinity= boot parameter if parsing fails
@ 2026-08-22 16:05 Lukas Beckmann
  2026-08-23 19:50 ` Radu Rendec
  2026-09-04  6:48 ` [tip: irq/core] " tip-bot2 for Lukas Beckmann
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Beckmann @ 2026-08-22 16:05 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Lukas Beckmann, Radu Rendec, linux-kernel

irq_affinity_setup() ignores the return value of cpulist_parse(). This
can result in using a "half parsed" cpulist. E.g. on a system with 8
cores, the parameter "irqaffinity=0,1,6-10,4" would result in using only
CPU 0 and 1, since the parsing fails at 6-10. Other boot parameters
which take a cpulist (e.g. isolcpus=, workqueue.unbound_cpus=) already
handle this by falling back to a default.

Check the return value of cpulist_parse() and let
init_irq_default_affinity() set the default in early_irq_init()
later, if parsing fails.

Signed-off-by: Lukas Beckmann <lbckmnn@mailbox.org>
---
 kernel/irq/irqdesc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 3a818f07a101..7cbcc3fb9e6d 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -28,7 +28,15 @@ static struct lock_class_key irq_desc_lock_class;
 static int __init irq_affinity_setup(char *str)
 {
 	alloc_bootmem_cpumask_var(&irq_default_affinity);
-	cpulist_parse(str, irq_default_affinity);
+	if (cpulist_parse(str, irq_default_affinity) < 0) {
+		/*
+		 * Clear the mask so that init_irq_default_affinity()
+		 * defaults it later.
+		 */
+		cpumask_clear(irq_default_affinity);
+		pr_warn("irqaffinity: incorrect CPU range, using default\n");
+		return 1;
+	}
 	/*
 	 * Set at least the boot cpu. We don't want to end up with
 	 * bugreports caused by random commandline masks

base-commit: 1ad6d4a722f509128038f9c85c6a122a382179fe
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-04  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-22 16:05 [PATCH] genirq: Discard cpumask of irqaffinity= boot parameter if parsing fails Lukas Beckmann
2026-08-23 19:50 ` Radu Rendec
2026-09-04  6:48 ` [tip: irq/core] " tip-bot2 for Lukas Beckmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®