* [PATCH] MIPS: Loongson-3: Fix a cpu-hotplug issue in loongson3_ipi_interrupt()
@ 2015-06-04 6:53 Huacai Chen
2015-06-05 8:20 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Huacai Chen @ 2015-06-04 6:53 UTC (permalink / raw)
To: Ralf Baechle
Cc: John Crispin, Steven J. Hill, linux-mips, Fuxin Zhang,
Zhangjin Wu, Huacai Chen
setup_per_cpu_areas() only setup __per_cpu_offset[] for each possible
cpu, but loongson_sysconf.nr_cpus can be greater than possible cpus
(due to reserved_cpus_mask). So in loongson3_ipi_interrupt(), percpu
access will touch the original varible in .data..percpu section which
has been freed. Without this patch, cpu-hotplug will cause memery
corruption.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
arch/mips/loongson/loongson-3/smp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/mips/loongson/loongson-3/smp.c b/arch/mips/loongson/loongson-3/smp.c
index e3c68b5..509877c 100644
--- a/arch/mips/loongson/loongson-3/smp.c
+++ b/arch/mips/loongson/loongson-3/smp.c
@@ -272,7 +272,7 @@ void loongson3_ipi_interrupt(struct pt_regs *regs)
if (action & SMP_ASK_C0COUNT) {
BUG_ON(cpu != 0);
c0count = read_c0_count();
- for (i = 1; i < loongson_sysconf.nr_cpus; i++)
+ for (i = 1; i < num_possible_cpus(); i++)
per_cpu(core0_c0count, i) = c0count;
}
}
--
1.7.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MIPS: Loongson-3: Fix a cpu-hotplug issue in loongson3_ipi_interrupt()
2015-06-04 6:53 [PATCH] MIPS: Loongson-3: Fix a cpu-hotplug issue in loongson3_ipi_interrupt() Huacai Chen
@ 2015-06-05 8:20 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2015-06-05 8:20 UTC (permalink / raw)
To: Huacai Chen
Cc: John Crispin, Steven J. Hill, linux-mips, Fuxin Zhang,
Zhangjin Wu
Thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-05 8:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-04 6:53 [PATCH] MIPS: Loongson-3: Fix a cpu-hotplug issue in loongson3_ipi_interrupt() Huacai Chen
2015-06-05 8:20 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.