Skip to content

Commit 1b5ba35

Browse files
deggemanRussell King
authored and
Russell King
committed
ARM: 8824/1: fix a migrating irq bug when hotplug cpu
Arm TC2 fails cpu hotplug stress test. This issue was tracked down to a missing copy of the new affinity cpumask for the vexpress-spc interrupt into struct irq_common_data.affinity when the interrupt is migrated in migrate_one_irq(). Fix it by replacing the arm specific hotplug cpu migration with the generic irq code. This is the counterpart implementation to commit 217d453 ("arm64: fix a migrating irq bug when hotplug cpu"). Tested with cpu hotplug stress test on Arm TC2 (multi_v7_defconfig plus CONFIG_ARM_BIG_LITTLE_CPUFREQ=y and CONFIG_ARM_VEXPRESS_SPC_CPUFREQ=y). The vexpress-spc interrupt (irq=22) on this board is affine to CPU0. Its affinity cpumask now changes correctly e.g. from 0 to 1-4 when CPU0 is hotplugged out. Suggested-by: Marc Zyngier <[email protected]> Signed-off-by: Dietmar Eggemann <[email protected]> Acked-by: Marc Zyngier <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent bfeffd1 commit 1b5ba35

File tree

4 files changed

+2
-64
lines changed

4 files changed

+2
-64
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,7 @@ config NR_CPUS
14001400
config HOTPLUG_CPU
14011401
bool "Support for hot-pluggable CPUs"
14021402
depends on SMP
1403+
select GENERIC_IRQ_MIGRATION
14031404
help
14041405
Say Y here to experiment with turning CPUs off and on. CPUs
14051406
can be controlled through /sys/devices/system/cpu.

arch/arm/include/asm/irq.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#ifndef __ASSEMBLY__
2626
struct irqaction;
2727
struct pt_regs;
28-
extern void migrate_irqs(void);
2928

3029
extern void asm_do_IRQ(unsigned int, struct pt_regs *);
3130
void handle_IRQ(unsigned int, struct pt_regs *);

arch/arm/kernel/irq.c

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <linux/smp.h>
3232
#include <linux/init.h>
3333
#include <linux/seq_file.h>
34-
#include <linux/ratelimit.h>
3534
#include <linux/errno.h>
3635
#include <linux/list.h>
3736
#include <linux/kallsyms.h>
@@ -109,64 +108,3 @@ int __init arch_probe_nr_irqs(void)
109108
return nr_irqs;
110109
}
111110
#endif
112-
113-
#ifdef CONFIG_HOTPLUG_CPU
114-
static bool migrate_one_irq(struct irq_desc *desc)
115-
{
116-
struct irq_data *d = irq_desc_get_irq_data(desc);
117-
const struct cpumask *affinity = irq_data_get_affinity_mask(d);
118-
struct irq_chip *c;
119-
bool ret = false;
120-
121-
/*
122-
* If this is a per-CPU interrupt, or the affinity does not
123-
* include this CPU, then we have nothing to do.
124-
*/
125-
if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
126-
return false;
127-
128-
if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
129-
affinity = cpu_online_mask;
130-
ret = true;
131-
}
132-
133-
c = irq_data_get_irq_chip(d);
134-
if (!c->irq_set_affinity)
135-
pr_debug("IRQ%u: unable to set affinity\n", d->irq);
136-
else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
137-
cpumask_copy(irq_data_get_affinity_mask(d), affinity);
138-
139-
return ret;
140-
}
141-
142-
/*
143-
* The current CPU has been marked offline. Migrate IRQs off this CPU.
144-
* If the affinity settings do not allow other CPUs, force them onto any
145-
* available CPU.
146-
*
147-
* Note: we must iterate over all IRQs, whether they have an attached
148-
* action structure or not, as we need to get chained interrupts too.
149-
*/
150-
void migrate_irqs(void)
151-
{
152-
unsigned int i;
153-
struct irq_desc *desc;
154-
unsigned long flags;
155-
156-
local_irq_save(flags);
157-
158-
for_each_irq_desc(i, desc) {
159-
bool affinity_broken;
160-
161-
raw_spin_lock(&desc->lock);
162-
affinity_broken = migrate_one_irq(desc);
163-
raw_spin_unlock(&desc->lock);
164-
165-
if (affinity_broken)
166-
pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
167-
i, smp_processor_id());
168-
}
169-
170-
local_irq_restore(flags);
171-
}
172-
#endif /* CONFIG_HOTPLUG_CPU */

arch/arm/kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ int __cpu_disable(void)
254254
/*
255255
* OK - migrate IRQs away from this CPU
256256
*/
257-
migrate_irqs();
257+
irq_migrate_all_off_this_cpu();
258258

259259
/*
260260
* Flush user cache and TLB mappings, and then remove this CPU

0 commit comments

Comments
 (0)