Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH resend 2/5] mips: Fix SMP builds
       [not found] <1430778649-28126-1-git-send-email-linux@roeck-us.net>
@ 2015-05-04 22:30 ` Guenter Roeck
  0 siblings, 0 replies; only message in thread
From: Guenter Roeck @ 2015-05-04 22:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Geert Uytterhoeven, Guenter Roeck, Rusty Russell, linux-mips,
	Ralf Baechle

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@rustcorp.com.au>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Tested-by: Paul Martin <paul.martin@codethink.co.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-04 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1430778649-28126-1-git-send-email-linux@roeck-us.net>
2015-05-04 22:30 ` [PATCH resend 2/5] mips: Fix SMP builds Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox