genirq: Add default affinity mask command line option
authorThomas Gleixner <tglx@linutronix.de>
Wed, 4 Feb 2015 05:12:25 +0000 (14:12 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:41:53 +0000 (13:41 +0900)
If we isolate CPUs, then we don't want random device interrupts on
them. Even w/o the user space irq balancer enabled we can end up with
irqs on non boot cpus.

Allow to restrict the default irq affinity mask.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
[k.kozlowski: rebased on 4.1, no signed-off-by of previous committer]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Documentation/kernel-parameters.txt
kernel/irq/irqdesc.c

index 7bcd7a2..e00f74f 100644 (file)
@@ -1564,6 +1564,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
        ip=             [IP_PNP]
                        See Documentation/filesystems/nfs/nfsroot.txt.
 
+                       irqaffinity=    [SMP] Set the default irq affinity mask
+                       Format:
+                       <cpu number>,...,<cpu number>
+                       or
+                       <cpu number>-<cpu number>
+                       (must be a positive range in ascending order)
+                       or a mixture
+                       <cpu number>,...,<cpu number>-<cpu number>
+
        irqfixup        [HW]
                        When an interrupt is not handled search all handlers
                        for it. Intended to get systems with badly broken
index 99793b9..e17a281 100644 (file)
 static struct lock_class_key irq_desc_lock_class;
 
 #if defined(CONFIG_SMP)
+static int __init irq_affinity_setup(char *str)
+{
+       zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
+       cpulist_parse(str, irq_default_affinity);
+       /*
+        * Set at least the boot cpu. We don't want to end up with
+        * bugreports caused by random comandline masks
+        */
+       cpumask_set_cpu(smp_processor_id(), irq_default_affinity);
+       return 1;
+}
+__setup("irqaffinity=", irq_affinity_setup);
+
 static void __init init_irq_default_affinity(void)
 {
-       alloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
-       cpumask_setall(irq_default_affinity);
+#ifdef CONFIG_CPUMASK_OFFSTACK
+       if (!irq_default_affinity)
+               zalloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT);
+#endif
+       if (cpumask_empty(irq_default_affinity))
+               cpumask_setall(irq_default_affinity);
 }
 #else
 static void __init init_irq_default_affinity(void)