aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-03-07 21:00:46 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-03-07 21:00:46 +0000
commit48a5431777fa6cd7b369073a2cb1f1b4b0f76911 (patch)
tree6404243ed431d510c1f9a4c1b94173b2b05fbaaf
parentd37e8522233419d629d611c836794cb320d97388 (diff)
downloadmaster-187ad058-48a5431777fa6cd7b369073a2cb1f1b4b0f76911.tar.gz
master-187ad058-48a5431777fa6cd7b369073a2cb1f1b4b0f76911.tar.bz2
master-187ad058-48a5431777fa6cd7b369073a2cb1f1b4b0f76911.zip
kernel: add MIPS kernel fix for an uninitialized CPU map
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48956 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/generic/patches-4.4/103-MIPS-smp.c-Fix-uninitialised-temp_foreign_map.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/target/linux/generic/patches-4.4/103-MIPS-smp.c-Fix-uninitialised-temp_foreign_map.patch b/target/linux/generic/patches-4.4/103-MIPS-smp.c-Fix-uninitialised-temp_foreign_map.patch
new file mode 100644
index 0000000000..6fe9d96ccc
--- /dev/null
+++ b/target/linux/generic/patches-4.4/103-MIPS-smp.c-Fix-uninitialised-temp_foreign_map.patch
@@ -0,0 +1,31 @@
+From: James Hogan <james.hogan@imgtec.com>
+Date: Fri, 4 Mar 2016 10:10:51 +0000
+Subject: [PATCH] MIPS: smp.c: Fix uninitialised temp_foreign_map
+
+When calculate_cpu_foreign_map() recalculates the cpu_foreign_map
+cpumask it uses the local variable temp_foreign_map without initialising
+it to zero. Since the calculation only ever sets bits in this cpumask
+any existing bits at that memory location will remain set and find their
+way into cpu_foreign_map too. This could potentially lead to cache
+operations suboptimally doing smp calls to multiple VPEs in the same
+core, even though the VPEs share primary caches.
+
+Therefore initialise temp_foreign_map using cpumask_clear() before use.
+
+Fixes: cccf34e9411c ("MIPS: c-r4k: Fix cache flushing for MT cores")
+Signed-off-by: James Hogan <james.hogan@imgtec.com>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: Paul Burton <paul.burton@imgtec.com>
+Cc: linux-mips@linux-mips.org
+---
+
+--- a/arch/mips/kernel/smp.c
++++ b/arch/mips/kernel/smp.c
+@@ -121,6 +121,7 @@ static inline void calculate_cpu_foreign
+ cpumask_t temp_foreign_map;
+
+ /* Re-calculate the mask */
++ cpumask_clear(&temp_foreign_map);
+ for_each_online_cpu(i) {
+ core_present = 0;
+ for_each_cpu(k, &temp_foreign_map)