Skip to contentSkip to conversation

ppc64: Add a sync in context switch on SMP

PATCH New Benjamin Herrenschmidt 1 participant 1 message Mar 30, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc64: Add a sync in context switch on SMP

Hi !

For the same reason as ppc32, we need to ensure that all stores done on a CPU has reached the coherency domain and are visible to loads done by another CPU when context switching as the same thread may be rescheduled almost right away there.

Ben.

arch/ppc64/kernel/entry.S +8 -0
diff -urN linux-2.5/arch/ppc64/kernel/entry.S linuxppc-2.5-benh/arch/ppc64/kernel/entry.S
@@ -289,6 +289,14 @@
 	std	r23,_CCR(r1)
 	std	r1,KSP(r3)	/* Set old stack pointer */
 
+#ifdef CONFIG_SMP
+	/* We need a sync somewhere here to make sure that if the
+	 * previous task gets rescheduled on another CPU, it sees all
+	 * stores it has performed on this one.
+	 */
+	sync
+#endif /* CONFIG_SMP */
+
 	addi	r6,r4,-THREAD	/* Convert THREAD to 'current' */
 	std	r6,PACACURRENT(r13)	/* Set new 'current' */