Skip to content

Commit a978e13

Browse files
ozbenhmpe
authored andcommitted
powerpc/smp: Remove migrate_irq() custom implementation
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>
1 parent 14d4ae5 commit a978e13

File tree

4 files changed

+9
-42
lines changed

4 files changed

+9
-42
lines changed

arch/powerpc/include/asm/smp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ extern void smp_generic_take_timebase(void);
6262
DECLARE_PER_CPU(unsigned int, cpu_pvr);
6363

6464
#ifdef CONFIG_HOTPLUG_CPU
65-
extern void migrate_irqs(void);
6665
int generic_cpu_disable(void);
6766
void generic_cpu_die(unsigned int cpu);
6867
void generic_set_cpu_dead(unsigned int cpu);

arch/powerpc/kernel/irq.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -442,46 +442,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
442442
return sum;
443443
}
444444

445-
#ifdef CONFIG_HOTPLUG_CPU
446-
void migrate_irqs(void)
447-
{
448-
struct irq_desc *desc;
449-
unsigned int irq;
450-
static int warned;
451-
cpumask_var_t mask;
452-
const struct cpumask *map = cpu_online_mask;
453-
454-
alloc_cpumask_var(&mask, GFP_KERNEL);
455-
456-
for_each_irq_desc(irq, desc) {
457-
struct irq_data *data;
458-
struct irq_chip *chip;
459-
460-
data = irq_desc_get_irq_data(desc);
461-
if (irqd_is_per_cpu(data))
462-
continue;
463-
464-
chip = irq_data_get_irq_chip(data);
465-
466-
cpumask_and(mask, irq_data_get_affinity_mask(data), map);
467-
if (cpumask_any(mask) >= nr_cpu_ids) {
468-
pr_warn("Breaking affinity for irq %i\n", irq);
469-
cpumask_copy(mask, map);
470-
}
471-
if (chip->irq_set_affinity)
472-
chip->irq_set_affinity(data, mask, true);
473-
else if (desc->action && !(warned++))
474-
pr_err("Cannot set affinity for irq %i\n", irq);
475-
}
476-
477-
free_cpumask_var(mask);
478-
479-
local_irq_enable();
480-
mdelay(1);
481-
local_irq_disable();
482-
}
483-
#endif
484-
485445
static inline void check_stack_overflow(void)
486446
{
487447
#ifdef CONFIG_DEBUG_STACKOVERFLOW

arch/powerpc/kernel/smp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,14 @@ int generic_cpu_disable(void)
439439
#ifdef CONFIG_PPC64
440440
vdso_data->processorCount--;
441441
#endif
442-
migrate_irqs();
442+
/* Update affinity of all IRQs previously aimed at this CPU */
443+
irq_migrate_all_off_this_cpu();
444+
445+
/* Give the CPU time to drain in-flight ones */
446+
local_irq_enable();
447+
mdelay(1);
448+
local_irq_disable();
449+
443450
return 0;
444451
}
445452

arch/powerpc/platforms/Kconfig.cputype

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ config PPC_PERF_CTRS
373373

374374
config SMP
375375
depends on PPC_BOOK3S || PPC_BOOK3E || FSL_BOOKE || PPC_47x
376+
select GENERIC_IRQ_MIGRATION
376377
bool "Symmetric multi-processing support"
377378
---help---
378379
This enables support for systems with more than one CPU. If you have

0 commit comments

Comments
 (0)