diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-02-18 12:59:28 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-02-18 12:59:28 -0500 |
| commit | 3ddc14e25e7fef143d35fdd0cad1e8dcf48efaa7 (patch) | |
| tree | d8d6bb055a619ee7a778633379bfa979fa4f259d | |
| parent | 10f4902173130fcbb02a69566fefab35fc5f1f30 (diff) | |
| parent | fc67e6f120a388b611d94cc40baf99a5cc56b283 (diff) | |
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King:
"A few ARM fixes:
- Dietmar Eggemann noticed an issue with IRQ migration during CPU
hotplug stress testing.
- Mathieu Desnoyers noticed that a previous fix broke optimised
kprobes.
- Robin Murphy noticed a case where we were not clearing the dma_ops"
* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
ARM: 8835/1: dma-mapping: Clear DMA ops on teardown
ARM: 8834/1: Fix: kprobes: optimized kprobes illegal instruction
ARM: 8824/1: fix a migrating irq bug when hotplug cpu
| -rw-r--r-- | arch/arm/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm/include/asm/irq.h | 1 | ||||
| -rw-r--r-- | arch/arm/kernel/irq.c | 62 | ||||
| -rw-r--r-- | arch/arm/kernel/smp.c | 2 | ||||
| -rw-r--r-- | arch/arm/mm/dma-mapping.c | 2 | ||||
| -rw-r--r-- | arch/arm/probes/kprobes/opt-arm.c | 2 |
6 files changed, 5 insertions, 65 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 664e918e2624..26524b75970a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -1400,6 +1400,7 @@ config NR_CPUS | |||
| 1400 | config HOTPLUG_CPU | 1400 | config HOTPLUG_CPU |
| 1401 | bool "Support for hot-pluggable CPUs" | 1401 | bool "Support for hot-pluggable CPUs" |
| 1402 | depends on SMP | 1402 | depends on SMP |
| 1403 | select GENERIC_IRQ_MIGRATION | ||
| 1403 | help | 1404 | help |
| 1404 | Say Y here to experiment with turning CPUs off and on. CPUs | 1405 | Say Y here to experiment with turning CPUs off and on. CPUs |
| 1405 | can be controlled through /sys/devices/system/cpu. | 1406 | can be controlled through /sys/devices/system/cpu. |
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h index c883fcbe93b6..46d41140df27 100644 --- a/arch/arm/include/asm/irq.h +++ b/arch/arm/include/asm/irq.h | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
| 26 | struct irqaction; | 26 | struct irqaction; |
| 27 | struct pt_regs; | 27 | struct pt_regs; |
| 28 | extern void migrate_irqs(void); | ||
| 29 | 28 | ||
| 30 | extern void asm_do_IRQ(unsigned int, struct pt_regs *); | 29 | extern void asm_do_IRQ(unsigned int, struct pt_regs *); |
| 31 | void handle_IRQ(unsigned int, struct pt_regs *); | 30 | void handle_IRQ(unsigned int, struct pt_regs *); |
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 9908dacf9229..844861368cd5 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/smp.h> | 31 | #include <linux/smp.h> |
| 32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
| 34 | #include <linux/ratelimit.h> | ||
| 35 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
| 36 | #include <linux/list.h> | 35 | #include <linux/list.h> |
| 37 | #include <linux/kallsyms.h> | 36 | #include <linux/kallsyms.h> |
| @@ -109,64 +108,3 @@ int __init arch_probe_nr_irqs(void) | |||
| 109 | return nr_irqs; | 108 | return nr_irqs; |
| 110 | } | 109 | } |
| 111 | #endif | 110 | #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 */ | ||
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 3bf82232b1be..1d6f5ea522f4 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -254,7 +254,7 @@ int __cpu_disable(void) | |||
| 254 | /* | 254 | /* |
| 255 | * OK - migrate IRQs away from this CPU | 255 | * OK - migrate IRQs away from this CPU |
| 256 | */ | 256 | */ |
| 257 | migrate_irqs(); | 257 | irq_migrate_all_off_this_cpu(); |
| 258 | 258 | ||
| 259 | /* | 259 | /* |
| 260 | * Flush user cache and TLB mappings, and then remove this CPU | 260 | * Flush user cache and TLB mappings, and then remove this CPU |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index f1e2922e447c..1e3e08a1c456 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
| @@ -2390,4 +2390,6 @@ void arch_teardown_dma_ops(struct device *dev) | |||
| 2390 | return; | 2390 | return; |
| 2391 | 2391 | ||
| 2392 | arm_teardown_iommu_dma_ops(dev); | 2392 | arm_teardown_iommu_dma_ops(dev); |
| 2393 | /* Let arch_setup_dma_ops() start again from scratch upon re-probe */ | ||
| 2394 | set_dma_ops(dev, NULL); | ||
| 2393 | } | 2395 | } |
diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c index 2c118a6ab358..0dc23fc227ed 100644 --- a/arch/arm/probes/kprobes/opt-arm.c +++ b/arch/arm/probes/kprobes/opt-arm.c | |||
| @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or | |||
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | /* Copy arch-dep-instance from template. */ | 249 | /* Copy arch-dep-instance from template. */ |
| 250 | memcpy(code, (unsigned char *)optprobe_template_entry, | 250 | memcpy(code, (unsigned long *)&optprobe_template_entry, |
| 251 | TMPL_END_IDX * sizeof(kprobe_opcode_t)); | 251 | TMPL_END_IDX * sizeof(kprobe_opcode_t)); |
| 252 | 252 | ||
| 253 | /* Adjust buffer according to instruction. */ | 253 | /* Adjust buffer according to instruction. */ |
