[PATCH resend 2/5] mips: Fix SMP builds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mips SMP builds fail with error messages similar to the following.

arch/mips/kernel/smp.c:211:2: error:
	passing argument 2 of 'cpumask_set_cpu' discards 'volatile'
	qualifier from pointer target type
arch/mips/kernel/process.c:52:2: error:
	passing argument 2 of 'cpumask_test_cpu' discards 'volatile'
	qualifier from pointer target type
arch/mips/cavium-octeon/smp.c:242:2: error:
	passing argument 2 of 'cpumask_clear_cpu' discards 'volatile'
	qualifier from pointer target type

cpu_callin_map is declared as volatile variable, but passed to various
functions with non-volatile arguments. Make it non-volatile and add a
memory barrier at the one location where volatile might be needed.

Fixes: 8dd928915a73 ("mips: fix up obsolete cpu function usage")
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Tested-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
Tested-by: Aaro Koskinen <aaro.koskinen@xxxxxxxxx>
Tested-by: Paul Martin <paul.martin@xxxxxxxxxxxxxxx>
Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
Please consider pushing this patch into mainline, or provide feedback
on how to improve it to be acceptable.

 arch/mips/include/asm/smp.h | 2 +-
 arch/mips/kernel/smp.c      | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index bb02fac9b4fa..2b25d1ba1ea0 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -45,7 +45,7 @@ extern int __cpu_logical_map[NR_CPUS];
 #define SMP_DUMP		0x8
 #define SMP_ASK_C0COUNT		0x10
 
-extern volatile cpumask_t cpu_callin_map;
+extern cpumask_t cpu_callin_map;
 
 /* Mask of CPUs which are currently definitely operating coherently */
 extern cpumask_t cpu_coherent_mask;
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 193ace7955fb..158191394770 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -43,7 +43,7 @@
 #include <asm/time.h>
 #include <asm/setup.h>
 
-volatile cpumask_t cpu_callin_map;	/* Bitmask of started secondaries */
+cpumask_t cpu_callin_map;		/* Bitmask of started secondaries */
 
 int __cpu_number_map[NR_CPUS];		/* Map physical to logical */
 EXPORT_SYMBOL(__cpu_number_map);
@@ -218,8 +218,10 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
 	/*
 	 * Trust is futile.  We should really have timeouts ...
 	 */
-	while (!cpumask_test_cpu(cpu, &cpu_callin_map))
+	while (!cpumask_test_cpu(cpu, &cpu_callin_map)) {
 		udelay(100);
+		mb();
+	}
 
 	synchronise_count_master(cpu);
 	return 0;
-- 
2.1.0






[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux