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

[PATCH] PPC - fix pthread_once for nptl



For PPC 32/64, pthread_once may fail if contention invalidates the reservation
for once_control between the load-and_reserve and the Store_conditional. This 
code is missing a bne instruction to retry sequence if the store conditional
fails.

Thanks to Olof Jonansson for finding this one.

2003-07-21  Steven Munroe <sjmunroe us ibm com>

        * sysdeps/unix/sysv/linux/powerpc/pthread_once.c (pthread_once):
	Retry if the stwcx fails to store once_control.


-- 
Steven Munroe
sjmunroe us ibm com
Linux on PowerPC-64 Development
GLIBC for PowerPC-64 Development
diff -urN nptl-0.53/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c libc23/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c
--- nptl-0.53/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c	2003-03-20 03:57:06.000000000 -0600
+++ libc23/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c	2003-07-21 12:42:14.000000000 -0500
@@ -55,6 +55,7 @@
 			"	andi.	%1,%0,2\n"
 			"	bne	2f\n"
 			"	stwcx.	%4,0,%3\n"
+			"	bne	1b\n"
 			"2:	isync"
 			: "=&r" (oldval), "=&r" (tmp), "=m" (*once_control)
 			: "r" (once_control), "r" (newval), "m" (*once_control)

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