]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.31/arm-8824-1-fix-a-migrating-irq-bug-when-hotplug-cpu.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / arm-8824-1-fix-a-migrating-irq-bug-when-hotplug-cpu.patch
CommitLineData
36e3f504
SL
1From 3aa4a4b9d30d001b67bb35113cf0fbb9d433c6f5 Mon Sep 17 00:00:00 2001
2From: Dietmar Eggemann <dietmar.eggemann@arm.com>
3Date: Mon, 21 Jan 2019 14:42:42 +0100
4Subject: ARM: 8824/1: fix a migrating irq bug when hotplug cpu
5
6[ Upstream commit 1b5ba350784242eb1f899bcffd95d2c7cff61e84 ]
7
8Arm TC2 fails cpu hotplug stress test.
9
10This issue was tracked down to a missing copy of the new affinity
11cpumask for the vexpress-spc interrupt into struct
12irq_common_data.affinity when the interrupt is migrated in
13migrate_one_irq().
14
15Fix it by replacing the arm specific hotplug cpu migration with the
16generic irq code.
17
18This is the counterpart implementation to commit 217d453d473c ("arm64:
19fix a migrating irq bug when hotplug cpu").
20
21Tested with cpu hotplug stress test on Arm TC2 (multi_v7_defconfig plus
22CONFIG_ARM_BIG_LITTLE_CPUFREQ=y and CONFIG_ARM_VEXPRESS_SPC_CPUFREQ=y).
23The vexpress-spc interrupt (irq=22) on this board is affine to CPU0.
24Its affinity cpumask now changes correctly e.g. from 0 to 1-4 when
25CPU0 is hotplugged out.
26
27Suggested-by: Marc Zyngier <marc.zyngier@arm.com>
28Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
29Acked-by: Marc Zyngier <marc.zyngier@arm.com>
30Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
31Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
32Signed-off-by: Sasha Levin <sashal@kernel.org>
33---
34 arch/arm/Kconfig | 1 +
35 arch/arm/include/asm/irq.h | 1 -
36 arch/arm/kernel/irq.c | 62 --------------------------------------
37 arch/arm/kernel/smp.c | 2 +-
38 4 files changed, 2 insertions(+), 64 deletions(-)
39
40diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
41index e8cd55a5b04c..cd4c74daf71e 100644
42--- a/arch/arm/Kconfig
43+++ b/arch/arm/Kconfig
44@@ -1444,6 +1444,7 @@ config NR_CPUS
45 config HOTPLUG_CPU
46 bool "Support for hot-pluggable CPUs"
47 depends on SMP
48+ select GENERIC_IRQ_MIGRATION
49 help
50 Say Y here to experiment with turning CPUs off and on. CPUs
51 can be controlled through /sys/devices/system/cpu.
52diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
53index c883fcbe93b6..46d41140df27 100644
54--- a/arch/arm/include/asm/irq.h
55+++ b/arch/arm/include/asm/irq.h
56@@ -25,7 +25,6 @@
57 #ifndef __ASSEMBLY__
58 struct irqaction;
59 struct pt_regs;
60-extern void migrate_irqs(void);
61
62 extern void asm_do_IRQ(unsigned int, struct pt_regs *);
63 void handle_IRQ(unsigned int, struct pt_regs *);
64diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
65index 9908dacf9229..844861368cd5 100644
66--- a/arch/arm/kernel/irq.c
67+++ b/arch/arm/kernel/irq.c
68@@ -31,7 +31,6 @@
69 #include <linux/smp.h>
70 #include <linux/init.h>
71 #include <linux/seq_file.h>
72-#include <linux/ratelimit.h>
73 #include <linux/errno.h>
74 #include <linux/list.h>
75 #include <linux/kallsyms.h>
76@@ -109,64 +108,3 @@ int __init arch_probe_nr_irqs(void)
77 return nr_irqs;
78 }
79 #endif
80-
81-#ifdef CONFIG_HOTPLUG_CPU
82-static bool migrate_one_irq(struct irq_desc *desc)
83-{
84- struct irq_data *d = irq_desc_get_irq_data(desc);
85- const struct cpumask *affinity = irq_data_get_affinity_mask(d);
86- struct irq_chip *c;
87- bool ret = false;
88-
89- /*
90- * If this is a per-CPU interrupt, or the affinity does not
91- * include this CPU, then we have nothing to do.
92- */
93- if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
94- return false;
95-
96- if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
97- affinity = cpu_online_mask;
98- ret = true;
99- }
100-
101- c = irq_data_get_irq_chip(d);
102- if (!c->irq_set_affinity)
103- pr_debug("IRQ%u: unable to set affinity\n", d->irq);
104- else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
105- cpumask_copy(irq_data_get_affinity_mask(d), affinity);
106-
107- return ret;
108-}
109-
110-/*
111- * The current CPU has been marked offline. Migrate IRQs off this CPU.
112- * If the affinity settings do not allow other CPUs, force them onto any
113- * available CPU.
114- *
115- * Note: we must iterate over all IRQs, whether they have an attached
116- * action structure or not, as we need to get chained interrupts too.
117- */
118-void migrate_irqs(void)
119-{
120- unsigned int i;
121- struct irq_desc *desc;
122- unsigned long flags;
123-
124- local_irq_save(flags);
125-
126- for_each_irq_desc(i, desc) {
127- bool affinity_broken;
128-
129- raw_spin_lock(&desc->lock);
130- affinity_broken = migrate_one_irq(desc);
131- raw_spin_unlock(&desc->lock);
132-
133- if (affinity_broken)
134- pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
135- i, smp_processor_id());
136- }
137-
138- local_irq_restore(flags);
139-}
140-#endif /* CONFIG_HOTPLUG_CPU */
141diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
142index 3bf82232b1be..1d6f5ea522f4 100644
143--- a/arch/arm/kernel/smp.c
144+++ b/arch/arm/kernel/smp.c
145@@ -254,7 +254,7 @@ int __cpu_disable(void)
146 /*
147 * OK - migrate IRQs away from this CPU
148 */
149- migrate_irqs();
150+ irq_migrate_all_off_this_cpu();
151
152 /*
153 * Flush user cache and TLB mappings, and then remove this CPU
154--
1552.19.1
156