Title: [7934] trunk/arch/blackfin/mach-common/smp.c: Fix bug [#5745] - add smp_wmb() / smp_rmb() if smp_call_function() requires waiting.
Revision
7934
Author
adamliyi
Date
2009-12-04 01:56:21 -0500 (Fri, 04 Dec 2009)

Log Message

Fix bug [#5745] - add smp_wmb() / smp_rmb() if smp_call_function() requires waiting. This invalidates D-cache of the core invoking smp_call_function(). 

Modified Paths

Diff

Modified: trunk/arch/blackfin/mach-common/smp.c (7933 => 7934)


--- trunk/arch/blackfin/mach-common/smp.c	2009-12-04 03:32:11 UTC (rev 7933)
+++ trunk/arch/blackfin/mach-common/smp.c	2009-12-04 06:56:21 UTC (rev 7934)
@@ -119,9 +119,13 @@
 	wait = msg->call_struct.wait;
 	cpu_clear(cpu, msg->call_struct.pending);
 	func(info);
-	if (wait)
-		cpu_clear(cpu, msg->call_struct.waitmask);
-	else
+	if (wait) {
+		/* 'wait' usually means synchronization between CPUs.
+		 * Tell other CPU to invalidate D cache in case shared data
+		 * was changed by func() */
+		smp_wmb();
+		cpu_clear(cpu, *msg->call_struct.waitmask);
+	} else
 		kfree(msg);
 }
 
@@ -216,6 +220,8 @@
 			blackfin_dcache_invalidate_range(
 				(unsigned long)(&msg->call_struct.waitmask),
 				(unsigned long)(&msg->call_struct.waitmask));
+		/* Invalidate D cache. In case shared data is changed. */
+		smp_rmb();
 		kfree(msg);
 	}
 	return 0;
@@ -258,6 +264,8 @@
 			blackfin_dcache_invalidate_range(
 				(unsigned long)(&msg->call_struct.waitmask),
 				(unsigned long)(&msg->call_struct.waitmask));
+		/* Invalidate D cache. In case shared data is changed. */
+		smp_rmb();
 		kfree(msg);
 	}
 	return 0;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to