[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r25562 - in /fsf/glibc-2_19-branch/libc: ./ nptl/ nptl/sysdeps/sparc/sparc32/ nptl/sysdeps/sparc/sparc64/
- To: commits@xxxxxxxxxx
- Subject: [Commits] r25562 - in /fsf/glibc-2_19-branch/libc: ./ nptl/ nptl/sysdeps/sparc/sparc32/ nptl/sysdeps/sparc/sparc64/
- From: eglibc@xxxxxxxxxx
- Date: Wed, 04 Jun 2014 07:01:53 -0000
Author: eglibc
Date: Wed Jun 4 00:01:52 2014
New Revision: 25562
Log:
Import glibc-2.19 for 2014-06-04
Added:
fsf/glibc-2_19-branch/libc/nptl/tst-spin4.c
Modified:
fsf/glibc-2_19-branch/libc/ChangeLog
fsf/glibc-2_19-branch/libc/NEWS
fsf/glibc-2_19-branch/libc/nptl/Makefile
fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
Modified: fsf/glibc-2_19-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_19-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_19-branch/libc/ChangeLog Wed Jun 4 00:01:52 2014
@@ -1,3 +1,14 @@
+2014-06-03 Guo Yixuan <culu.gyx@xxxxxxxxx>
+
+ [BZ #16882]
+ * nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
+ (pthread_spin_lock): Branch out of spin loop to proper location.
+ * nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
+ (pthread_spin_lock): Likewise.
+
+ * nptl/tst-spin4.c: New test.
+ * nptl/Makefile (tests): Add tst-spin4.
+
2014-05-17 Jose E. Marchesi <jose.marchesi@xxxxxxxxxx>
[BZ #16958]
Modified: fsf/glibc-2_19-branch/libc/NEWS
==============================================================================
--- fsf/glibc-2_19-branch/libc/NEWS (original)
+++ fsf/glibc-2_19-branch/libc/NEWS Wed Jun 4 00:01:52 2014
@@ -9,7 +9,7 @@
* The following bugs are resolved with this release:
- 16545, 16623, 16885, 16916, 16943, 16958.
+ 16545, 16623, 16882, 16885, 16916, 16943, 16958.
Version 2.19
Modified: fsf/glibc-2_19-branch/libc/nptl/Makefile
==============================================================================
--- fsf/glibc-2_19-branch/libc/nptl/Makefile (original)
+++ fsf/glibc-2_19-branch/libc/nptl/Makefile Wed Jun 4 00:01:52 2014
@@ -208,7 +208,7 @@
tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
tst-mutexpi9 \
- tst-spin1 tst-spin2 tst-spin3 \
+ tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
Modified: fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
==============================================================================
--- fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S (original)
+++ fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S Wed Jun 4 00:01:52 2014
@@ -19,11 +19,11 @@
.text
ENTRY(pthread_spin_lock)
- ldstub [%o0], %g1
+1: ldstub [%o0], %g1
orcc %g1, 0x0, %g0
bne,a 2f
ldub [%o0], %g1
-1: retl
+ retl
mov 0, %o0
2: orcc %g1, 0x0, %g0
bne,a 2b
Modified: fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
==============================================================================
--- fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S (original)
+++ fsf/glibc-2_19-branch/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S Wed Jun 4 00:01:52 2014
@@ -19,10 +19,10 @@
.text
ENTRY(pthread_spin_lock)
- ldstub [%o0], %g1
+1: ldstub [%o0], %g1
brnz,pn %g1, 2f
membar #StoreLoad | #StoreStore
-1: retl
+ retl
mov 0, %o0
2: ldub [%o0], %g1
brnz,pt %g1, 2b
Added: fsf/glibc-2_19-branch/libc/nptl/tst-spin4.c
==============================================================================
--- fsf/glibc-2_19-branch/libc/nptl/tst-spin4.c (added)
+++ fsf/glibc-2_19-branch/libc/nptl/tst-spin4.c Wed Jun 4 00:01:52 2014
@@ -1,0 +1,109 @@
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int count = 0;
+
+static void *
+thread_add_one (void *arg)
+{
+ int tmp;
+ pthread_spinlock_t *lock = (pthread_spinlock_t *) arg;
+
+ /* When do_test holds the lock for 1 sec, the two thread will be
+ in contention for the lock. */
+ if (pthread_spin_lock (lock) != 0)
+ {
+ puts ("thread_add_one(): spin_lock failed");
+ pthread_exit ((void *) 1l);
+ }
+
+ /* sleep 1s before modifying count */
+ tmp = count;
+ sleep (1);
+ count = tmp + 1;
+
+ if (pthread_spin_unlock (lock) != 0)
+ {
+ puts ("thread_add_one(): spin_unlock failed");
+ pthread_exit ((void *) 1l);
+ }
+
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ pthread_t thr1, thr2;
+ pthread_spinlock_t lock;
+ int tmp;
+
+ if (pthread_spin_init (&lock, PTHREAD_PROCESS_PRIVATE) != 0)
+ {
+ puts ("spin_init failed");
+ return 1;
+ }
+
+ if (pthread_spin_lock (&lock) != 0)
+ {
+ puts ("1st spin_lock failed");
+ return 1;
+ }
+
+ if (pthread_create (&thr1, NULL, thread_add_one, (void *) &lock) != 0)
+ {
+ puts ("1st pthread_create failed");
+ return 1;
+ }
+
+ if (pthread_create (&thr2, NULL, thread_add_one, (void *) &lock) != 0)
+ {
+ puts ("2nd pthread_create failed");
+ return 1;
+ }
+
+ /* sleep 1s before modifying count */
+ tmp = count;
+ sleep (1);
+ count = tmp + 1;
+
+ if (pthread_spin_unlock (&lock) != 0)
+ {
+ puts ("1st spin_unlock failed");
+ return 1;
+ }
+
+ void *status;
+ if (pthread_join (thr1, &status) != 0)
+ {
+ puts ("1st pthread_join failed");
+ return 1;
+ }
+ if (status != NULL)
+ {
+ puts ("failure in the 1st thread");
+ return 1;
+ }
+ if (pthread_join (thr2, &status) != 0)
+ {
+ puts ("2nd pthread_join failed");
+ return 1;
+ }
+ if (status != NULL)
+ {
+ puts ("failure in the 2nd thread");
+ return 1;
+ }
+
+ if (count != 3)
+ {
+ printf ("count is %d, should be 3\n", count);
+ return 1;
+ }
+ return 0;
+}
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits