]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
powerpc/smp: Remove migrate_irq() custom implementation
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 29 May 2017 14:54:38 +0000 (11:54 -0300)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 20 Jun 2017 08:49:49 +0000 (10:49 +0200)
BugLink: http://bugs.launchpad.net/bugs/1691973
Some powerpc platforms use this to move IRQs away from a CPU being
unplugged. This function has several bugs such as not taking the right
locks or failing to NULL check pointers.

There's a new generic function doing exactly the same thing without all
the bugs, so let's use it instead.

mpe: The obvious place for the select of GENERIC_IRQ_MIGRATION is on
HOTPLUG_CPU, but that doesn't work. On some configs PM_SLEEP_SMP will
select HOTPLUG_CPU even though its dependencies are not met, which means
the select of GENERIC_IRQ_MIGRATION doesn't happen. That leads to the
build breaking. Fix it by moving the select of GENERIC_IRQ_MIGRATION to
SMP.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit a978e13965a40ac07163643cc3fa0ddb0d354198)
Signed-off-by: Gustavo Walbon <gwalbon@linux.vnet.ibm.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/powerpc/include/asm/smp.h
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/smp.c
arch/powerpc/platforms/Kconfig.cputype

index 56ba9daefaa6d154409b7f31f4f48c2840af31c0..a2b6a7939a85cbbd2acfd8996e7f77848254af4d 100644 (file)
@@ -63,7 +63,6 @@ extern void smp_generic_take_timebase(void);
 DECLARE_PER_CPU(unsigned int, cpu_pvr);
 
 #ifdef CONFIG_HOTPLUG_CPU
-extern void migrate_irqs(void);
 int generic_cpu_disable(void);
 void generic_cpu_die(unsigned int cpu);
 void generic_set_cpu_dead(unsigned int cpu);
index a018f5cae899ae796840cea0492897970083fd79..8ee7b44450eb9b15ca168af14b5e3dd062d13281 100644 (file)
@@ -442,46 +442,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
        return sum;
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-void migrate_irqs(void)
-{
-       struct irq_desc *desc;
-       unsigned int irq;
-       static int warned;
-       cpumask_var_t mask;
-       const struct cpumask *map = cpu_online_mask;
-
-       alloc_cpumask_var(&mask, GFP_KERNEL);
-
-       for_each_irq_desc(irq, desc) {
-               struct irq_data *data;
-               struct irq_chip *chip;
-
-               data = irq_desc_get_irq_data(desc);
-               if (irqd_is_per_cpu(data))
-                       continue;
-
-               chip = irq_data_get_irq_chip(data);
-
-               cpumask_and(mask, irq_data_get_affinity_mask(data), map);
-               if (cpumask_any(mask) >= nr_cpu_ids) {
-                       pr_warn("Breaking affinity for irq %i\n", irq);
-                       cpumask_copy(mask, map);
-               }
-               if (chip->irq_set_affinity)
-                       chip->irq_set_affinity(data, mask, true);
-               else if (desc->action && !(warned++))
-                       pr_err("Cannot set affinity for irq %i\n", irq);
-       }
-
-       free_cpumask_var(mask);
-
-       local_irq_enable();
-       mdelay(1);
-       local_irq_disable();
-}
-#endif
-
 static inline void check_stack_overflow(void)
 {
 #ifdef CONFIG_DEBUG_STACKOVERFLOW
index 84f7ac4b9a3332b48c0c41beb5e013e8467c650a..c3c41851d67accd6c709b00a9140475ada3a4fd4 100644 (file)
@@ -437,7 +437,14 @@ int generic_cpu_disable(void)
 #ifdef CONFIG_PPC64
        vdso_data->processorCount--;
 #endif
-       migrate_irqs();
+       /* Update affinity of all IRQs previously aimed at this CPU */
+       irq_migrate_all_off_this_cpu();
+
+       /* Give the CPU time to drain in-flight ones */
+       local_irq_enable();
+       mdelay(1);
+       local_irq_disable();
+
        return 0;
 }
 
index 6e89e5a8d4fbfad10b724b010e5d95c9742b03a7..21448e503d97c553fb6ac379bfc9f67e0bd5d6b8 100644 (file)
@@ -366,6 +366,7 @@ config PPC_PERF_CTRS
 
 config SMP
        depends on PPC_BOOK3S || PPC_BOOK3E || FSL_BOOKE || PPC_47x
+       select GENERIC_IRQ_MIGRATION
        bool "Symmetric multi-processing support"
        ---help---
          This enables support for systems with more than one CPU. If you have