* [PATCH] hppa: Use generic pthread conditional variable support
@ 2017-03-12 14:58 John David Anglin
2017-03-12 17:59 ` Florian Weimer
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: John David Anglin @ 2017-03-12 14:58 UTC (permalink / raw)
To: GNU C Library; +Cc: Carlos O'Donell, Mike Frysinger, Helge Deller
[-- Attachment #1: Type: text/plain, Size: 318 bytes --]
The attach change switches the hppa target to use the generic pthread conditional variable support.
We lose compatibility with linuxthreads but I don't think that is relevant anymore for the existing distributions.
The change fixes bug nptl/21016.
Okay?
Dave
--
John David Anglin dave.anglin@bell.net
[-- Attachment #2: pthread_cond.d.1.txt --]
[-- Type: text/plain, Size: 16108 bytes --]
2017-03-12 John David Anglin <danglin@gcc.gnu.org>
[BZ #21016]
* sysdeps/hppa/nptl/bits/pthreadtypes.h: Use generic data structure
for conditional variables.
* sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear):
Remove.
(cond_compat_check_and_clear): Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread.h (PTHREAD_COND_INITIALIZER):
Revise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c: Delete file.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c: Likewise.
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
index e37111a2f3..4f742bfaa6 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h
@@ -103,39 +103,32 @@ typedef union
long int __align;
} pthread_mutexattr_t;
-
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. However, this structure
- is exposed via PTHREAD_COND_INITIALIZER, and because of this, the
- Linuxthreads version sets the first four ints to one. In the NPTL
- version we must check, in every function using pthread_cond_t,
- for the static Linuxthreads initializer and clear the appropriate
- words. */
+/* Data structure for conditional variable handling. */
typedef union
{
struct
{
- /* In the old Linuxthreads pthread_cond_t, this is the
- start of the 4-word lock structure, the next four words
- are set all to 1 by the Linuxthreads
- PTHREAD_COND_INITIALIZER. */
- int __lock __attribute__ ((__aligned__(16)));
- /* Tracks the initialization of this structure:
- 0 initialized with NPTL PTHREAD_COND_INITIALIZER.
- 1 initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
- 2 initialization in progress. */
- int __initializer;
- unsigned int __futex;
- void *__mutex;
- /* In the old Linuxthreads this would have been the start
- of the pthread_fastlock status word. */
- __extension__ unsigned long long int __total_seq;
- __extension__ unsigned long long int __wakeup_seq;
- __extension__ unsigned long long int __woken_seq;
- unsigned int __nwaiters;
- unsigned int __broadcast_seq;
- /* The NPTL pthread_cond_t is exactly the same size as
- the Linuxthreads version, there are no words to spare. */
+ __extension__ union
+ {
+ __extension__ unsigned long long int __wseq;
+ struct {
+ unsigned int __low;
+ unsigned int __high;
+ } __wseq32;
+ } __attribute__ ((__aligned__(16)));
+ __extension__ union
+ {
+ __extension__ unsigned long long int __g1_start;
+ struct {
+ unsigned int __low;
+ unsigned int __high;
+ } __g1_start32;
+ };
+ unsigned int __g_refs[2];
+ unsigned int __g_size[2];
+ unsigned int __g1_orig_size;
+ unsigned int __wrefs;
+ unsigned int __g_signals[2];
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
__extension__ long long int __align;
diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
deleted file mode 100644
index d6496579da..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#include_next <internaltypes.h>
-#ifndef _INTERNAL_TYPES_H_HPPA_
-#define _INTERNAL_TYPES_H_HPPA_ 1
-#include <atomic.h>
-
-/* In GLIBC 2.10 HPPA switched from Linuxthreads to NPTL, and in order
-to maintain ABI compatibility with pthread_cond_t, some care had to be
-taken.
-
-The NPTL pthread_cond_t grew in size. When HPPA switched to NPTL, we
-dropped the use of ldcw, and switched to the kernel helper routine for
-compare-and-swap. This allowed HPPA to use the 4-word 16-byte aligned
-lock words, and alignment words to store the additional pthread_cond_t
-data. Once organized properly the new NPTL pthread_cond_t was 1 word
-smaller than the Linuxthreads version.
-
-However, we were faced with the case that users may have initialized the
-pthread_cond_t with PTHREAD_COND_INITIALIZER. In this case, the first
-four words were set to one, and must be cleared before any NPTL code
-used these words.
-
-We didn't want to use LDCW, because it continues to be a source of bugs
-when applications memset pthread_cond_t to all zeroes by accident. This
-works on all other architectures where lock words are unlocked at zero.
-Remember that because of the semantics of LDCW, a locked word is set to
-zero, and an unlocked word is set to 1.
-
-Instead we used atomic_compare_and_exchange_val_acq, but we couldn't use
-this on any of the pthread_cond_t words, otherwise it might interfere
-with the current operation of the structure. To solve this problem we
-used the left over word.
-
-If the stucture was initialized by a legacy Linuxthread
-PTHREAD_COND_INITIALIZER it contained a 1, and this indicates that the
-structure requires zeroing for NPTL. The first thread to come upon a
-pthread_cond_t with a 1 in the __initializer field, will
-compare-and-swap the value, placing a 2 there which will cause all other
-threads using the same pthread_cond_t to wait for the completion of the
-initialization. Lastly, we use a store (with memory barrier) to change
-__initializer from 2 to 0. Note that the store is strongly ordered, but
-we use the PA 1.1 compatible form which is ",ma" with zero offset.
-
-In the future, when the application is recompiled with NPTL
-PTHREAD_COND_INITIALIZER it will be a quick compare-and-swap, which
-fails because __initializer is zero, and the structure will be used as
-is correctly. */
-
-#define cond_compat_clear(var) \
-({ \
- int tmp = 0; \
- var->__data.__wseq = 0; \
- var->__data.__signals_sent = 0; \
- var->__data.__confirmed = 0; \
- var->__data.__generation = 0; \
- var->__data.__mutex = NULL; \
- var->__data.__quiescence_waiters = 0; \
- var->__data.__clockid = 0; \
- /* Clear __initializer last, to indicate initialization is done. */ \
- /* This synchronizes-with the acquire load below. */ \
- atomic_store_release (&var->__data.__initializer, 0); \
-})
-
-#define cond_compat_check_and_clear(var) \
-({ \
- int v; \
- int *value = &var->__data.__initializer; \
- /* This synchronizes-with the release store above. */ \
- while ((v = atomic_load_acquire (value)) != 0) \
- { \
- if (v == 1 \
- /* Relaxed MO is fine; it only matters who's first. */ \
- && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \
- { \
- /* We're first; initialize structure. */ \
- cond_compat_clear (var); \
- break; \
- } \
- else \
- /* Yield before we re-check initialization status. */ \
- sched_yield (); \
- } \
-})
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread.h b/sysdeps/unix/sysv/linux/hppa/pthread.h
index ac617201d2..d3b960edd4 100644
--- a/sysdeps/unix/sysv/linux/hppa/pthread.h
+++ b/sysdeps/unix/sysv/linux/hppa/pthread.h
@@ -185,7 +185,7 @@ enum
/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
+#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
/* Cleanup buffers */
@@ -1165,12 +1165,6 @@ __END_DECLS
#ifndef _PTHREAD_H_HPPA_
#define _PTHREAD_H_HPPA_ 1
-/* The pthread_cond_t initializer is compatible only with NPTL. We do not
- want to be forwards compatible, we eventually want to drop the code
- that has to clear the old LT initializer. */
-#undef PTHREAD_COND_INITIALIZER
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, (void *) 0, 0, 0, 0, 0, 0 } }
-
/* The pthread_mutex_t and pthread_rwlock_t initializers are compatible
only with NPTL. NPTL assumes pthread_rwlock_t is all zero. */
#undef PTHREAD_MUTEX_INITIALIZER
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
deleted file mode 100644
index a6f9f5d433..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_broadcast.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_broadcast (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_broadcast_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_broadcast
-# define __pthread_cond_broadcast __pthread_cond_broadcast_internal
-# include_next <pthread_cond_broadcast.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
deleted file mode 100644
index 49af087bb4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_destroy.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_destroy (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_destroy_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_destroy, pthread_cond_destroy,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_destroy
-# define __pthread_cond_destroy __pthread_cond_destroy_internal
-# include_next <pthread_cond_destroy.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
deleted file mode 100644
index 2bf32af933..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_signal.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_signal (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_signal_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_signal
-# define __pthread_cond_signal __pthread_cond_signal_internal
-# include_next <pthread_cond_signal.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
deleted file mode 100644
index 1cc2fc15d4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_wait.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_wait_internal (cond, mutex);
-}
-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-int
-__pthread_cond_timedwait (cond, mutex, abstime)
- pthread_cond_t *cond;
- pthread_mutex_t *mutex;
- const struct timespec *abstime;
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_timedwait_internal (cond, mutex, abstime);
-}
-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_wait
-# define __pthread_cond_wait __pthread_cond_wait_internal
-# undef __pthread_cond_timedwait
-# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
-# include_next <pthread_cond_wait.c>
-#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 14:58 [PATCH] hppa: Use generic pthread conditional variable support John David Anglin
@ 2017-03-12 17:59 ` Florian Weimer
2017-03-12 18:41 ` John David Anglin
2017-03-12 19:42 ` Torvald Riegel
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Florian Weimer @ 2017-03-12 17:59 UTC (permalink / raw)
To: John David Anglin, GNU C Library
Cc: Carlos O'Donell, Mike Frysinger, Helge Deller
On 03/12/2017 03:58 PM, John David Anglin wrote:
> - int __lock __attribute__ ((__aligned__(16)));
If this reduces the type alignment from 16 to 4, that's not acceptable
because it changes application struct offsets when a condition variable
is embedded into a struct.
Thanks,
Florian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 17:59 ` Florian Weimer
@ 2017-03-12 18:41 ` John David Anglin
0 siblings, 0 replies; 12+ messages in thread
From: John David Anglin @ 2017-03-12 18:41 UTC (permalink / raw)
To: Florian Weimer
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller
On 2017-03-12, at 1:59 PM, Florian Weimer wrote:
> On 03/12/2017 03:58 PM, John David Anglin wrote:
>> - int __lock __attribute__ ((__aligned__(16)));
>
> If this reduces the type alignment from 16 to 4, that's not acceptable because it changes application struct offsets when a condition variable is embedded into a struct.
I don't think so:
+ } __attribute__ ((__aligned__(16)));
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 14:58 [PATCH] hppa: Use generic pthread conditional variable support John David Anglin
2017-03-12 17:59 ` Florian Weimer
@ 2017-03-12 19:42 ` Torvald Riegel
2017-03-12 20:00 ` John David Anglin
2017-03-31 21:21 ` Aaro Koskinen
2017-04-01 14:01 ` [PATCH v2] hppa: Use generic pthread conditional variable support (BZ #21016) John David Anglin
3 siblings, 1 reply; 12+ messages in thread
From: Torvald Riegel @ 2017-03-12 19:42 UTC (permalink / raw)
To: John David Anglin
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller
On Sun, 2017-03-12 at 10:58 -0400, John David Anglin wrote:
> The attach change switches the hppa target to use the generic pthread conditional variable support.
> We lose compatibility with linuxthreads but I don't think that is relevant anymore for the existing distributions.
>
> The change fixes bug nptl/21016.
>
> Okay?
Carlos was thinking about re-arranging the struct layout and reserving
the LSB of __g1_orig_size for the bit that would be set in a condvar
initialized by linuxthreads:
https://sourceware.org/ml/libc-alpha/2017-03/msg00058.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 19:42 ` Torvald Riegel
@ 2017-03-12 20:00 ` John David Anglin
2017-03-12 20:07 ` John David Anglin
2017-03-15 7:22 ` Mike Frysinger
0 siblings, 2 replies; 12+ messages in thread
From: John David Anglin @ 2017-03-12 20:00 UTC (permalink / raw)
To: Torvald Riegel
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller
On 2017-03-12, at 3:41 PM, Torvald Riegel wrote:
> Carlos was thinking about re-arranging the struct layout and reserving
> the LSB of __g1_orig_size for the bit that would be set in a condvar
> initialized by linuxthreads:
> https://sourceware.org/ml/libc-alpha/2017-03/msg00058.html
It's up to Carlos. Personally, I'm not sure it's worth maintaining the linuxthreads compatibility.
Removing it gets rid of a lot of hppa code.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 20:00 ` John David Anglin
@ 2017-03-12 20:07 ` John David Anglin
2017-03-15 7:22 ` Mike Frysinger
1 sibling, 0 replies; 12+ messages in thread
From: John David Anglin @ 2017-03-12 20:07 UTC (permalink / raw)
To: John David Anglin
Cc: Torvald Riegel, GNU C Library, Carlos O'Donell,
Mike Frysinger, Helge Deller
On 2017-03-12, at 4:00 PM, John David Anglin wrote:
> On 2017-03-12, at 3:41 PM, Torvald Riegel wrote:
>
>> Carlos was thinking about re-arranging the struct layout and reserving
>> the LSB of __g1_orig_size for the bit that would be set in a condvar
>> initialized by linuxthreads:
>> https://sourceware.org/ml/libc-alpha/2017-03/msg00058.html
>
> It's up to Carlos. Personally, I'm not sure it's worth maintaining the linuxthreads compatibility.
> Removing it gets rid of a lot of hppa code.
Oh, I know Carlos had said he was going to work on this bug. I sent my patch because Richard asked
if there was any progress on this bug. He's been working on supporting parisc in qemu.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 20:00 ` John David Anglin
2017-03-12 20:07 ` John David Anglin
@ 2017-03-15 7:22 ` Mike Frysinger
1 sibling, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2017-03-15 7:22 UTC (permalink / raw)
To: John David Anglin
Cc: Torvald Riegel, GNU C Library, Carlos O'Donell, Helge Deller
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On 12 Mar 2017 16:00, John David Anglin wrote:
> On 2017-03-12, at 3:41 PM, Torvald Riegel wrote:
> > Carlos was thinking about re-arranging the struct layout and reserving
> > the LSB of __g1_orig_size for the bit that would be set in a condvar
> > initialized by linuxthreads:
> > https://sourceware.org/ml/libc-alpha/2017-03/msg00058.html
>
> It's up to Carlos. Personally, I'm not sure it's worth maintaining the linuxthreads compatibility.
> Removing it gets rid of a lot of hppa code.
i agree -- linuxthreads should die w/hppa. if we can keep compat with
nptl but drop linuxthreads, let's do it. we've already broken the ABI
once after the linuxthreads->nptl change.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-12 14:58 [PATCH] hppa: Use generic pthread conditional variable support John David Anglin
2017-03-12 17:59 ` Florian Weimer
2017-03-12 19:42 ` Torvald Riegel
@ 2017-03-31 21:21 ` Aaro Koskinen
2017-03-31 22:35 ` John David Anglin
2017-04-01 14:01 ` [PATCH v2] hppa: Use generic pthread conditional variable support (BZ #21016) John David Anglin
3 siblings, 1 reply; 12+ messages in thread
From: Aaro Koskinen @ 2017-03-31 21:21 UTC (permalink / raw)
To: John David Anglin
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller
Hi,
On Sun, Mar 12, 2017 at 10:58:46AM -0400, John David Anglin wrote:
> The attach change switches the hppa target to use the generic pthread
> conditional variable support. We lose compatibility with linuxthreads
> but I don't think that is relevant anymore for the existing distributions.
>
> The change fixes bug nptl/21016.
>
> Okay?
[...]
> 2017-03-12 John David Anglin <danglin@gcc.gnu.org>
>
> [BZ #21016]
> * sysdeps/hppa/nptl/bits/pthreadtypes.h: Use generic data structure
> for conditional variables.
> * sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear):
> Remove.
> (cond_compat_check_and_clear): Likewise.
> * sysdeps/unix/sysv/linux/hppa/pthread.h (PTHREAD_COND_INITIALIZER):
> Revise.
> * sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c: Delete file.
> * sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c: Likewise.
> * sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c: Likewise.
> * sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c: Likewise.
Should you delete sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
as well? That code is calling cond_compat_clear() which is removed by
your changes, and the linking fails.
A.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] hppa: Use generic pthread conditional variable support
2017-03-31 21:21 ` Aaro Koskinen
@ 2017-03-31 22:35 ` John David Anglin
0 siblings, 0 replies; 12+ messages in thread
From: John David Anglin @ 2017-03-31 22:35 UTC (permalink / raw)
To: Aaro Koskinen
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller
On 2017-03-31, at 5:21 PM, Aaro Koskinen wrote:
> Should you delete sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
> as well? That code is calling cond_compat_clear() which is removed by
> your changes, and the linking fails.
You are correct. I had inadvertently removed it from index in my local tree. I'll prepare a new patch.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] hppa: Use generic pthread conditional variable support (BZ #21016)
2017-03-12 14:58 [PATCH] hppa: Use generic pthread conditional variable support John David Anglin
` (2 preceding siblings ...)
2017-03-31 21:21 ` Aaro Koskinen
@ 2017-04-01 14:01 ` John David Anglin
2017-04-10 23:11 ` [PATCH v3] " John David Anglin
3 siblings, 1 reply; 12+ messages in thread
From: John David Anglin @ 2017-04-01 14:01 UTC (permalink / raw)
To: John David Anglin
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller,
Aaro Koskinen
[-- Attachment #1: Type: text/plain, Size: 2972 bytes --]
On 2017-03-12, at 10:58 AM, John David Anglin wrote:
> The attach change switches the hppa target to use the generic pthread conditional variable support.
> We lose compatibility with linuxthreads but I don't think that is relevant anymore for the existing distributions.
>
> The change fixes bug nptl/21016.
Here is an updated patch to switch hppa to generic pthread conditional variable support.
As noted by Aaro, the original patch didn't delete sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c. This
is corrected here. Otherwise, the patches are the same.
Retested last night on my tree with the following results:
FAIL: debug/tst-backtrace2
FAIL: debug/tst-backtrace3
FAIL: debug/tst-backtrace4
FAIL: debug/tst-backtrace5
FAIL: debug/tst-backtrace6
FAIL: elf/check-execstack
FAIL: elf/check-textrel
FAIL: elf/tst-audit2
FAIL: malloc/tst-malloc-thread-fail
FAIL: malloc/tst-trim1
FAIL: math/test-double-cacos
FAIL: math/test-double-cacosh
FAIL: math/test-double-canonicalize
FAIL: math/test-double-casin
FAIL: math/test-double-casinh
FAIL: math/test-double-catan
FAIL: math/test-double-catanh
FAIL: math/test-double-finite-cacos
FAIL: math/test-double-finite-cacosh
FAIL: math/test-double-finite-casin
FAIL: math/test-double-finite-casinh
FAIL: math/test-double-finite-catan
FAIL: math/test-double-finite-catanh
FAIL: math/test-float-cacos
FAIL: math/test-float-cacosh
FAIL: math/test-float-canonicalize
FAIL: math/test-float-casin
FAIL: math/test-float-casinh
FAIL: math/test-float-catan
FAIL: math/test-float-catanh
FAIL: math/test-float-finite-cacos
FAIL: math/test-float-finite-cacosh
FAIL: math/test-float-finite-casin
FAIL: math/test-float-finite-casinh
FAIL: math/test-float-finite-catan
FAIL: math/test-float-finite-catanh
FAIL: math/test-idouble-cacos
FAIL: math/test-idouble-cacosh
FAIL: math/test-idouble-canonicalize
FAIL: math/test-idouble-casin
FAIL: math/test-idouble-casinh
FAIL: math/test-idouble-catan
FAIL: math/test-idouble-catanh
FAIL: math/test-ifloat-cacos
FAIL: math/test-ifloat-cacosh
FAIL: math/test-ifloat-canonicalize
FAIL: math/test-ifloat-casin
FAIL: math/test-ifloat-casinh
FAIL: math/test-ifloat-catan
FAIL: math/test-ifloat-catanh
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nptl/tst-cleanupx4
FAIL: nptl/tst-cond25
FAIL: nptl/tst-create-detached
FAIL: nptl/tst-robust-fork
FAIL: nptl/tst-rwlock19
FAIL: nptl/tst-stack4
FAIL: nptl/tst-typesizes
FAIL: resolv/tst-resolv-basic
FAIL: resolv/tst-resolv-search
FAIL: stdlib/tst-setcontext2
UNSUPPORTED: sunrpc/tst-svc_register
FAIL: timezone/tst-tzset
Summary of test results:
61 FAIL
3225 PASS
7 UNSUPPORTED
45 XFAIL
Dave
--
John David Anglin dave.anglin@bell.net
[-- Attachment #2: pthread_cond-v2.d.txt --]
[-- Type: text/plain, Size: 18036 bytes --]
2017-04-01 John David Anglin <danglin@gcc.gnu.org>
[BZ #21016]
* sysdeps/hppa/nptl/bits/pthreadtypes.h: Use generic data structure
for conditional variables.
* sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear):
Remove.
(cond_compat_check_and_clear): Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread.h (PTHREAD_COND_INITIALIZER):
Revise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c: Delete file.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c: Likewise.
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
index e37111a2f3..4f742bfaa6 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h
@@ -103,39 +103,32 @@ typedef union
long int __align;
} pthread_mutexattr_t;
-
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. However, this structure
- is exposed via PTHREAD_COND_INITIALIZER, and because of this, the
- Linuxthreads version sets the first four ints to one. In the NPTL
- version we must check, in every function using pthread_cond_t,
- for the static Linuxthreads initializer and clear the appropriate
- words. */
+/* Data structure for conditional variable handling. */
typedef union
{
struct
{
- /* In the old Linuxthreads pthread_cond_t, this is the
- start of the 4-word lock structure, the next four words
- are set all to 1 by the Linuxthreads
- PTHREAD_COND_INITIALIZER. */
- int __lock __attribute__ ((__aligned__(16)));
- /* Tracks the initialization of this structure:
- 0 initialized with NPTL PTHREAD_COND_INITIALIZER.
- 1 initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
- 2 initialization in progress. */
- int __initializer;
- unsigned int __futex;
- void *__mutex;
- /* In the old Linuxthreads this would have been the start
- of the pthread_fastlock status word. */
- __extension__ unsigned long long int __total_seq;
- __extension__ unsigned long long int __wakeup_seq;
- __extension__ unsigned long long int __woken_seq;
- unsigned int __nwaiters;
- unsigned int __broadcast_seq;
- /* The NPTL pthread_cond_t is exactly the same size as
- the Linuxthreads version, there are no words to spare. */
+ __extension__ union
+ {
+ __extension__ unsigned long long int __wseq;
+ struct {
+ unsigned int __low;
+ unsigned int __high;
+ } __wseq32;
+ } __attribute__ ((__aligned__(16)));
+ __extension__ union
+ {
+ __extension__ unsigned long long int __g1_start;
+ struct {
+ unsigned int __low;
+ unsigned int __high;
+ } __g1_start32;
+ };
+ unsigned int __g_refs[2];
+ unsigned int __g_size[2];
+ unsigned int __g1_orig_size;
+ unsigned int __wrefs;
+ unsigned int __g_signals[2];
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
__extension__ long long int __align;
diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
deleted file mode 100644
index d6496579da..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#include_next <internaltypes.h>
-#ifndef _INTERNAL_TYPES_H_HPPA_
-#define _INTERNAL_TYPES_H_HPPA_ 1
-#include <atomic.h>
-
-/* In GLIBC 2.10 HPPA switched from Linuxthreads to NPTL, and in order
-to maintain ABI compatibility with pthread_cond_t, some care had to be
-taken.
-
-The NPTL pthread_cond_t grew in size. When HPPA switched to NPTL, we
-dropped the use of ldcw, and switched to the kernel helper routine for
-compare-and-swap. This allowed HPPA to use the 4-word 16-byte aligned
-lock words, and alignment words to store the additional pthread_cond_t
-data. Once organized properly the new NPTL pthread_cond_t was 1 word
-smaller than the Linuxthreads version.
-
-However, we were faced with the case that users may have initialized the
-pthread_cond_t with PTHREAD_COND_INITIALIZER. In this case, the first
-four words were set to one, and must be cleared before any NPTL code
-used these words.
-
-We didn't want to use LDCW, because it continues to be a source of bugs
-when applications memset pthread_cond_t to all zeroes by accident. This
-works on all other architectures where lock words are unlocked at zero.
-Remember that because of the semantics of LDCW, a locked word is set to
-zero, and an unlocked word is set to 1.
-
-Instead we used atomic_compare_and_exchange_val_acq, but we couldn't use
-this on any of the pthread_cond_t words, otherwise it might interfere
-with the current operation of the structure. To solve this problem we
-used the left over word.
-
-If the stucture was initialized by a legacy Linuxthread
-PTHREAD_COND_INITIALIZER it contained a 1, and this indicates that the
-structure requires zeroing for NPTL. The first thread to come upon a
-pthread_cond_t with a 1 in the __initializer field, will
-compare-and-swap the value, placing a 2 there which will cause all other
-threads using the same pthread_cond_t to wait for the completion of the
-initialization. Lastly, we use a store (with memory barrier) to change
-__initializer from 2 to 0. Note that the store is strongly ordered, but
-we use the PA 1.1 compatible form which is ",ma" with zero offset.
-
-In the future, when the application is recompiled with NPTL
-PTHREAD_COND_INITIALIZER it will be a quick compare-and-swap, which
-fails because __initializer is zero, and the structure will be used as
-is correctly. */
-
-#define cond_compat_clear(var) \
-({ \
- int tmp = 0; \
- var->__data.__wseq = 0; \
- var->__data.__signals_sent = 0; \
- var->__data.__confirmed = 0; \
- var->__data.__generation = 0; \
- var->__data.__mutex = NULL; \
- var->__data.__quiescence_waiters = 0; \
- var->__data.__clockid = 0; \
- /* Clear __initializer last, to indicate initialization is done. */ \
- /* This synchronizes-with the acquire load below. */ \
- atomic_store_release (&var->__data.__initializer, 0); \
-})
-
-#define cond_compat_check_and_clear(var) \
-({ \
- int v; \
- int *value = &var->__data.__initializer; \
- /* This synchronizes-with the release store above. */ \
- while ((v = atomic_load_acquire (value)) != 0) \
- { \
- if (v == 1 \
- /* Relaxed MO is fine; it only matters who's first. */ \
- && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \
- { \
- /* We're first; initialize structure. */ \
- cond_compat_clear (var); \
- break; \
- } \
- else \
- /* Yield before we re-check initialization status. */ \
- sched_yield (); \
- } \
-})
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread.h b/sysdeps/unix/sysv/linux/hppa/pthread.h
index ac617201d2..d3b960edd4 100644
--- a/sysdeps/unix/sysv/linux/hppa/pthread.h
+++ b/sysdeps/unix/sysv/linux/hppa/pthread.h
@@ -185,7 +185,7 @@ enum
/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
+#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
/* Cleanup buffers */
@@ -1165,12 +1165,6 @@ __END_DECLS
#ifndef _PTHREAD_H_HPPA_
#define _PTHREAD_H_HPPA_ 1
-/* The pthread_cond_t initializer is compatible only with NPTL. We do not
- want to be forwards compatible, we eventually want to drop the code
- that has to clear the old LT initializer. */
-#undef PTHREAD_COND_INITIALIZER
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, (void *) 0, 0, 0, 0, 0, 0 } }
-
/* The pthread_mutex_t and pthread_rwlock_t initializers are compatible
only with NPTL. NPTL assumes pthread_rwlock_t is all zero. */
#undef PTHREAD_MUTEX_INITIALIZER
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
deleted file mode 100644
index a6f9f5d433..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_broadcast.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_broadcast (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_broadcast_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_broadcast
-# define __pthread_cond_broadcast __pthread_cond_broadcast_internal
-# include_next <pthread_cond_broadcast.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
deleted file mode 100644
index 49af087bb4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_destroy.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_destroy (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_destroy_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_destroy, pthread_cond_destroy,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_destroy
-# define __pthread_cond_destroy __pthread_cond_destroy_internal
-# include_next <pthread_cond_destroy.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
deleted file mode 100644
index ccb3de07ff..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_init.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
-{
- cond_compat_clear (cond);
- return __pthread_cond_init_internal (cond, cond_attr);
-}
-versioned_symbol (libpthread, __pthread_cond_init, pthread_cond_init,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_init
-# define __pthread_cond_init __pthread_cond_init_internal
-# include_next <pthread_cond_init.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
deleted file mode 100644
index 2bf32af933..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_signal.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_signal (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_signal_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_signal
-# define __pthread_cond_signal __pthread_cond_signal_internal
-# include_next <pthread_cond_signal.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
deleted file mode 100644
index 1cc2fc15d4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_wait.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_wait_internal (cond, mutex);
-}
-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-int
-__pthread_cond_timedwait (cond, mutex, abstime)
- pthread_cond_t *cond;
- pthread_mutex_t *mutex;
- const struct timespec *abstime;
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_timedwait_internal (cond, mutex, abstime);
-}
-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_wait
-# define __pthread_cond_wait __pthread_cond_wait_internal
-# undef __pthread_cond_timedwait
-# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
-# include_next <pthread_cond_wait.c>
-#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3] hppa: Use generic pthread conditional variable support (BZ #21016)
2017-04-01 14:01 ` [PATCH v2] hppa: Use generic pthread conditional variable support (BZ #21016) John David Anglin
@ 2017-04-10 23:11 ` John David Anglin
2017-06-04 16:51 ` [PATCH v4] " John David Anglin
0 siblings, 1 reply; 12+ messages in thread
From: John David Anglin @ 2017-04-10 23:11 UTC (permalink / raw)
To: John David Anglin
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller,
Aaro Koskinen
[-- Attachment #1: Type: text/plain, Size: 4602 bytes --]
On 2017-04-01, at 10:01 AM, John David Anglin wrote:
> On 2017-03-12, at 10:58 AM, John David Anglin wrote:
>
>> The attach change switches the hppa target to use the generic pthread conditional variable support.
>> We lose compatibility with linuxthreads but I don't think that is relevant anymore for the existing distributions.
>>
>> The change fixes bug nptl/21016.
>
> Here is an updated patch to switch hppa to generic pthread conditional variable support.
The previous version had a problem, namely the failure of nptl/tst-typesizes. This was caused by an incorrect
size for the pthread_cond_t type. The placement of "__attribute__ ((__aligned__(16)))" increased the size.
This is fixed revising the pthread_cond_t declaration. New test results are below. Most of the math fails have been
fixed by a regen of the ulps.
>
> As noted by Aaro, the original patch didn't delete sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c. This
> is corrected here. Otherwise, the patches are the same.
>
> Retested last night on my tree with the following results:
>
> FAIL: debug/tst-backtrace2
> FAIL: debug/tst-backtrace3
> FAIL: debug/tst-backtrace4
> FAIL: debug/tst-backtrace5
> FAIL: debug/tst-backtrace6
> FAIL: elf/check-execstack
> FAIL: elf/check-textrel
> FAIL: elf/tst-audit2
> FAIL: malloc/tst-malloc-thread-fail
> FAIL: malloc/tst-trim1
> FAIL: math/test-double-cacos
> FAIL: math/test-double-cacosh
> FAIL: math/test-double-canonicalize
> FAIL: math/test-double-casin
> FAIL: math/test-double-casinh
> FAIL: math/test-double-catan
> FAIL: math/test-double-catanh
> FAIL: math/test-double-finite-cacos
> FAIL: math/test-double-finite-cacosh
> FAIL: math/test-double-finite-casin
> FAIL: math/test-double-finite-casinh
> FAIL: math/test-double-finite-catan
> FAIL: math/test-double-finite-catanh
> FAIL: math/test-float-cacos
> FAIL: math/test-float-cacosh
> FAIL: math/test-float-canonicalize
> FAIL: math/test-float-casin
> FAIL: math/test-float-casinh
> FAIL: math/test-float-catan
> FAIL: math/test-float-catanh
> FAIL: math/test-float-finite-cacos
> FAIL: math/test-float-finite-cacosh
> FAIL: math/test-float-finite-casin
> FAIL: math/test-float-finite-casinh
> FAIL: math/test-float-finite-catan
> FAIL: math/test-float-finite-catanh
> FAIL: math/test-idouble-cacos
> FAIL: math/test-idouble-cacosh
> FAIL: math/test-idouble-canonicalize
> FAIL: math/test-idouble-casin
> FAIL: math/test-idouble-casinh
> FAIL: math/test-idouble-catan
> FAIL: math/test-idouble-catanh
> FAIL: math/test-ifloat-cacos
> FAIL: math/test-ifloat-cacosh
> FAIL: math/test-ifloat-canonicalize
> FAIL: math/test-ifloat-casin
> FAIL: math/test-ifloat-casinh
> FAIL: math/test-ifloat-catan
> FAIL: math/test-ifloat-catanh
> UNSUPPORTED: nptl/test-cond-printers
> UNSUPPORTED: nptl/test-condattr-printers
> UNSUPPORTED: nptl/test-mutex-printers
> UNSUPPORTED: nptl/test-mutexattr-printers
> UNSUPPORTED: nptl/test-rwlock-printers
> UNSUPPORTED: nptl/test-rwlockattr-printers
> FAIL: nptl/tst-cleanupx4
> FAIL: nptl/tst-cond25
> FAIL: nptl/tst-create-detached
> FAIL: nptl/tst-robust-fork
> FAIL: nptl/tst-rwlock19
> FAIL: nptl/tst-stack4
> FAIL: nptl/tst-typesizes
> FAIL: resolv/tst-resolv-basic
> FAIL: resolv/tst-resolv-search
> FAIL: stdlib/tst-setcontext2
> UNSUPPORTED: sunrpc/tst-svc_register
> FAIL: timezone/tst-tzset
> Summary of test results:
> 61 FAIL
> 3225 PASS
> 7 UNSUPPORTED
> 45 XFAIL
V3 results:
FAIL: debug/tst-backtrace2
FAIL: debug/tst-backtrace3
FAIL: debug/tst-backtrace4
FAIL: debug/tst-backtrace5
FAIL: debug/tst-backtrace6
FAIL: elf/check-execstack
FAIL: elf/check-textrel
FAIL: elf/tst-audit2
FAIL: malloc/tst-malloc-thread-fail
FAIL: malloc/tst-trim1
FAIL: math/test-double-canonicalize
FAIL: math/test-float-canonicalize
FAIL: math/test-idouble-canonicalize
FAIL: math/test-ifloat-canonicalize
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
FAIL: nptl/tst-cleanupx4
FAIL: nptl/tst-cond25
FAIL: nptl/tst-create-detached
FAIL: nptl/tst-robust-fork
FAIL: nptl/tst-rwlock19
FAIL: resolv/tst-resolv-basic
FAIL: resolv/tst-resolv-search
FAIL: stdlib/tst-setcontext2
FAIL: timezone/tst-tzset
Summary of test results:
23 FAIL
3267 PASS
6 UNSUPPORTED
45 XFAIL
Dave
--
John David Anglin dave.anglin@bell.net
[-- Attachment #2: pthread_cond-v3.d.txt --]
[-- Type: text/plain, Size: 17371 bytes --]
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
index e37111a2f3..2f17318121 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h
@@ -103,40 +103,34 @@ typedef union
long int __align;
} pthread_mutexattr_t;
-
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. However, this structure
- is exposed via PTHREAD_COND_INITIALIZER, and because of this, the
- Linuxthreads version sets the first four ints to one. In the NPTL
- version we must check, in every function using pthread_cond_t,
- for the static Linuxthreads initializer and clear the appropriate
- words. */
+/* Data structure for conditional variable handling. */
typedef union
{
struct
{
- /* In the old Linuxthreads pthread_cond_t, this is the
- start of the 4-word lock structure, the next four words
- are set all to 1 by the Linuxthreads
- PTHREAD_COND_INITIALIZER. */
- int __lock __attribute__ ((__aligned__(16)));
- /* Tracks the initialization of this structure:
- 0 initialized with NPTL PTHREAD_COND_INITIALIZER.
- 1 initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
- 2 initialization in progress. */
- int __initializer;
- unsigned int __futex;
- void *__mutex;
- /* In the old Linuxthreads this would have been the start
- of the pthread_fastlock status word. */
- __extension__ unsigned long long int __total_seq;
- __extension__ unsigned long long int __wakeup_seq;
- __extension__ unsigned long long int __woken_seq;
- unsigned int __nwaiters;
- unsigned int __broadcast_seq;
- /* The NPTL pthread_cond_t is exactly the same size as
- the Linuxthreads version, there are no words to spare. */
+ __extension__ union
+ {
+ __extension__ unsigned long long int __wseq;
+ struct {
+ unsigned int __low;
+ unsigned int __high;
+ } __wseq32;
+ };
+ __extension__ union
+ {
+ __extension__ unsigned long long int __g1_start;
+ struct {
+ unsigned int __low;
+ unsigned int __high;
+ } __g1_start32;
+ };
+ unsigned int __g_refs[2];
+ unsigned int __g_size[2];
+ unsigned int __g1_orig_size;
+ unsigned int __wrefs;
+ unsigned int __g_signals[2];
} __data;
+ int __unused_lock __attribute__ ((__aligned__(16)));
char __size[__SIZEOF_PTHREAD_COND_T];
__extension__ long long int __align;
} pthread_cond_t;
diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
deleted file mode 100644
index d6496579da..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#include_next <internaltypes.h>
-#ifndef _INTERNAL_TYPES_H_HPPA_
-#define _INTERNAL_TYPES_H_HPPA_ 1
-#include <atomic.h>
-
-/* In GLIBC 2.10 HPPA switched from Linuxthreads to NPTL, and in order
-to maintain ABI compatibility with pthread_cond_t, some care had to be
-taken.
-
-The NPTL pthread_cond_t grew in size. When HPPA switched to NPTL, we
-dropped the use of ldcw, and switched to the kernel helper routine for
-compare-and-swap. This allowed HPPA to use the 4-word 16-byte aligned
-lock words, and alignment words to store the additional pthread_cond_t
-data. Once organized properly the new NPTL pthread_cond_t was 1 word
-smaller than the Linuxthreads version.
-
-However, we were faced with the case that users may have initialized the
-pthread_cond_t with PTHREAD_COND_INITIALIZER. In this case, the first
-four words were set to one, and must be cleared before any NPTL code
-used these words.
-
-We didn't want to use LDCW, because it continues to be a source of bugs
-when applications memset pthread_cond_t to all zeroes by accident. This
-works on all other architectures where lock words are unlocked at zero.
-Remember that because of the semantics of LDCW, a locked word is set to
-zero, and an unlocked word is set to 1.
-
-Instead we used atomic_compare_and_exchange_val_acq, but we couldn't use
-this on any of the pthread_cond_t words, otherwise it might interfere
-with the current operation of the structure. To solve this problem we
-used the left over word.
-
-If the stucture was initialized by a legacy Linuxthread
-PTHREAD_COND_INITIALIZER it contained a 1, and this indicates that the
-structure requires zeroing for NPTL. The first thread to come upon a
-pthread_cond_t with a 1 in the __initializer field, will
-compare-and-swap the value, placing a 2 there which will cause all other
-threads using the same pthread_cond_t to wait for the completion of the
-initialization. Lastly, we use a store (with memory barrier) to change
-__initializer from 2 to 0. Note that the store is strongly ordered, but
-we use the PA 1.1 compatible form which is ",ma" with zero offset.
-
-In the future, when the application is recompiled with NPTL
-PTHREAD_COND_INITIALIZER it will be a quick compare-and-swap, which
-fails because __initializer is zero, and the structure will be used as
-is correctly. */
-
-#define cond_compat_clear(var) \
-({ \
- int tmp = 0; \
- var->__data.__wseq = 0; \
- var->__data.__signals_sent = 0; \
- var->__data.__confirmed = 0; \
- var->__data.__generation = 0; \
- var->__data.__mutex = NULL; \
- var->__data.__quiescence_waiters = 0; \
- var->__data.__clockid = 0; \
- /* Clear __initializer last, to indicate initialization is done. */ \
- /* This synchronizes-with the acquire load below. */ \
- atomic_store_release (&var->__data.__initializer, 0); \
-})
-
-#define cond_compat_check_and_clear(var) \
-({ \
- int v; \
- int *value = &var->__data.__initializer; \
- /* This synchronizes-with the release store above. */ \
- while ((v = atomic_load_acquire (value)) != 0) \
- { \
- if (v == 1 \
- /* Relaxed MO is fine; it only matters who's first. */ \
- && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \
- { \
- /* We're first; initialize structure. */ \
- cond_compat_clear (var); \
- break; \
- } \
- else \
- /* Yield before we re-check initialization status. */ \
- sched_yield (); \
- } \
-})
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread.h b/sysdeps/unix/sysv/linux/hppa/pthread.h
index ac617201d2..d3b960edd4 100644
--- a/sysdeps/unix/sysv/linux/hppa/pthread.h
+++ b/sysdeps/unix/sysv/linux/hppa/pthread.h
@@ -185,7 +185,7 @@ enum
/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
+#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
/* Cleanup buffers */
@@ -1165,12 +1165,6 @@ __END_DECLS
#ifndef _PTHREAD_H_HPPA_
#define _PTHREAD_H_HPPA_ 1
-/* The pthread_cond_t initializer is compatible only with NPTL. We do not
- want to be forwards compatible, we eventually want to drop the code
- that has to clear the old LT initializer. */
-#undef PTHREAD_COND_INITIALIZER
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, (void *) 0, 0, 0, 0, 0, 0 } }
-
/* The pthread_mutex_t and pthread_rwlock_t initializers are compatible
only with NPTL. NPTL assumes pthread_rwlock_t is all zero. */
#undef PTHREAD_MUTEX_INITIALIZER
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
deleted file mode 100644
index a6f9f5d433..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_broadcast.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_broadcast (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_broadcast_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_broadcast
-# define __pthread_cond_broadcast __pthread_cond_broadcast_internal
-# include_next <pthread_cond_broadcast.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
deleted file mode 100644
index 49af087bb4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_destroy.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_destroy (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_destroy_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_destroy, pthread_cond_destroy,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_destroy
-# define __pthread_cond_destroy __pthread_cond_destroy_internal
-# include_next <pthread_cond_destroy.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
deleted file mode 100644
index ccb3de07ff..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_init.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
-{
- cond_compat_clear (cond);
- return __pthread_cond_init_internal (cond, cond_attr);
-}
-versioned_symbol (libpthread, __pthread_cond_init, pthread_cond_init,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_init
-# define __pthread_cond_init __pthread_cond_init_internal
-# include_next <pthread_cond_init.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
deleted file mode 100644
index 2bf32af933..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_signal.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_signal (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_signal_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_signal
-# define __pthread_cond_signal __pthread_cond_signal_internal
-# include_next <pthread_cond_signal.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
deleted file mode 100644
index 1cc2fc15d4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_wait.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_wait_internal (cond, mutex);
-}
-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-int
-__pthread_cond_timedwait (cond, mutex, abstime)
- pthread_cond_t *cond;
- pthread_mutex_t *mutex;
- const struct timespec *abstime;
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_timedwait_internal (cond, mutex, abstime);
-}
-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_wait
-# define __pthread_cond_wait __pthread_cond_wait_internal
-# undef __pthread_cond_timedwait
-# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
-# include_next <pthread_cond_wait.c>
-#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4] hppa: Use generic pthread conditional variable support (BZ #21016)
2017-04-10 23:11 ` [PATCH v3] " John David Anglin
@ 2017-06-04 16:51 ` John David Anglin
0 siblings, 0 replies; 12+ messages in thread
From: John David Anglin @ 2017-06-04 16:51 UTC (permalink / raw)
To: John David Anglin
Cc: GNU C Library, Carlos O'Donell, Mike Frysinger, Helge Deller,
Aaro Koskinen
[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]
On 2017-04-10, at 7:10 PM, John David Anglin wrote:
>> Here is an updated patch to switch hppa to generic pthread conditional variable support.
>
> The previous version had a problem, namely the failure of nptl/tst-typesizes. This was caused by an incorrect
> size for the pthread_cond_t type. The placement of "__attribute__ ((__aligned__(16)))" increased the size.
>
> This is fixed revising the pthread_cond_t declaration.
Another update was needed due to more changes in the pthread type definitions on trunk.
This version fixes a typo in sysdeps/nptl/bits/thread-shared-types.h.
I moved forward the hppa pthread initializers in sysdeps/unix/sysv/linux/hppa/pthread.h and
eliminated the old copies of the generic initializers. I included "bits/types/struct_timespec.h"
to make sysdeps/unix/sysv/linux/hppa/pthread.h consistent with the generic version.
Old unused files are removed.
Tested with a couple of builds and checks.
Dave
--
John David Anglin dave.anglin@bell.net
[-- Attachment #2: pthread_cond-v4.d.txt --]
[-- Type: text/plain, Size: 19710 bytes --]
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
index d95ac9ac13..1e45f2d8ce 100644
--- a/sysdeps/nptl/bits/thread-shared-types.h
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -118,7 +118,7 @@ struct __pthread_mutex_s
{
__PTHREAD_SPINS_DATA;
__pthread_slist_t __list;
- }
+ };
#endif
__PTHREAD_COMPAT_PADDING_END;
};
diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h
deleted file mode 100644
index d6496579da..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#include_next <internaltypes.h>
-#ifndef _INTERNAL_TYPES_H_HPPA_
-#define _INTERNAL_TYPES_H_HPPA_ 1
-#include <atomic.h>
-
-/* In GLIBC 2.10 HPPA switched from Linuxthreads to NPTL, and in order
-to maintain ABI compatibility with pthread_cond_t, some care had to be
-taken.
-
-The NPTL pthread_cond_t grew in size. When HPPA switched to NPTL, we
-dropped the use of ldcw, and switched to the kernel helper routine for
-compare-and-swap. This allowed HPPA to use the 4-word 16-byte aligned
-lock words, and alignment words to store the additional pthread_cond_t
-data. Once organized properly the new NPTL pthread_cond_t was 1 word
-smaller than the Linuxthreads version.
-
-However, we were faced with the case that users may have initialized the
-pthread_cond_t with PTHREAD_COND_INITIALIZER. In this case, the first
-four words were set to one, and must be cleared before any NPTL code
-used these words.
-
-We didn't want to use LDCW, because it continues to be a source of bugs
-when applications memset pthread_cond_t to all zeroes by accident. This
-works on all other architectures where lock words are unlocked at zero.
-Remember that because of the semantics of LDCW, a locked word is set to
-zero, and an unlocked word is set to 1.
-
-Instead we used atomic_compare_and_exchange_val_acq, but we couldn't use
-this on any of the pthread_cond_t words, otherwise it might interfere
-with the current operation of the structure. To solve this problem we
-used the left over word.
-
-If the stucture was initialized by a legacy Linuxthread
-PTHREAD_COND_INITIALIZER it contained a 1, and this indicates that the
-structure requires zeroing for NPTL. The first thread to come upon a
-pthread_cond_t with a 1 in the __initializer field, will
-compare-and-swap the value, placing a 2 there which will cause all other
-threads using the same pthread_cond_t to wait for the completion of the
-initialization. Lastly, we use a store (with memory barrier) to change
-__initializer from 2 to 0. Note that the store is strongly ordered, but
-we use the PA 1.1 compatible form which is ",ma" with zero offset.
-
-In the future, when the application is recompiled with NPTL
-PTHREAD_COND_INITIALIZER it will be a quick compare-and-swap, which
-fails because __initializer is zero, and the structure will be used as
-is correctly. */
-
-#define cond_compat_clear(var) \
-({ \
- int tmp = 0; \
- var->__data.__wseq = 0; \
- var->__data.__signals_sent = 0; \
- var->__data.__confirmed = 0; \
- var->__data.__generation = 0; \
- var->__data.__mutex = NULL; \
- var->__data.__quiescence_waiters = 0; \
- var->__data.__clockid = 0; \
- /* Clear __initializer last, to indicate initialization is done. */ \
- /* This synchronizes-with the acquire load below. */ \
- atomic_store_release (&var->__data.__initializer, 0); \
-})
-
-#define cond_compat_check_and_clear(var) \
-({ \
- int v; \
- int *value = &var->__data.__initializer; \
- /* This synchronizes-with the release store above. */ \
- while ((v = atomic_load_acquire (value)) != 0) \
- { \
- if (v == 1 \
- /* Relaxed MO is fine; it only matters who's first. */ \
- && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \
- { \
- /* We're first; initialize structure. */ \
- cond_compat_clear (var); \
- break; \
- } \
- else \
- /* Yield before we re-check initialization status. */ \
- sched_yield (); \
- } \
-})
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread.h b/sysdeps/unix/sysv/linux/hppa/pthread.h
index ac617201d2..d1973741cd 100644
--- a/sysdeps/unix/sysv/linux/hppa/pthread.h
+++ b/sysdeps/unix/sysv/linux/hppa/pthread.h
@@ -26,6 +26,7 @@
#include <bits/pthreadtypes.h>
#include <bits/setjmp.h>
#include <bits/wordsize.h>
+#include <bits/types/struct_timespec.h>
/* Detach state. */
@@ -82,32 +83,18 @@ enum
#endif
-#ifdef __PTHREAD_MUTEX_HAVE_PREV
-# define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } }
-# ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __PTHREAD_SPINS, { 0, 0 } } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-
-# endif
-#else
-# define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, 0, { __PTHREAD_SPINS } } }
-# ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { __PTHREAD_SPINS } } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { __PTHREAD_SPINS } } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { __PTHREAD_SPINS } } }
-
-# endif
+#define PTHREAD_MUTEX_INITIALIZER \
+ { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { __PTHREAD_SPINS }, { 0, 0 } } }
+#ifdef __USE_GNU
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, \
+ { __PTHREAD_SPINS }, { 0, 0 } } }
+# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, \
+ { __PTHREAD_SPINS }, { 0, 0 } } }
+# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
+ { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, \
+ { __PTHREAD_SPINS }, { 0, 0 } } }
#endif
@@ -130,25 +117,14 @@ enum
# endif
#endif
+
/* Read-write lock initializers. */
# define PTHREAD_RWLOCK_INITIALIZER \
- { { 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, 0 } }
+ { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
# ifdef __USE_GNU
-# ifdef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
-# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { { 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, \
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
-# else
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, \
- 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, 0 } }
-# else
-# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,\
- 0 } }
-# endif
-# endif
+# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
+ { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0, 0, 0 } }
# endif
#endif /* Unix98 or XOpen2K */
@@ -183,9 +159,8 @@ enum
};
-
/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
+#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
/* Cleanup buffers */
@@ -1161,43 +1136,3 @@ __NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2))
__END_DECLS
#endif /* pthread.h */
-
-#ifndef _PTHREAD_H_HPPA_
-#define _PTHREAD_H_HPPA_ 1
-
-/* The pthread_cond_t initializer is compatible only with NPTL. We do not
- want to be forwards compatible, we eventually want to drop the code
- that has to clear the old LT initializer. */
-#undef PTHREAD_COND_INITIALIZER
-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, (void *) 0, 0, 0, 0, 0, 0 } }
-
-/* The pthread_mutex_t and pthread_rwlock_t initializers are compatible
- only with NPTL. NPTL assumes pthread_rwlock_t is all zero. */
-#undef PTHREAD_MUTEX_INITIALIZER
-#undef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
-#undef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-#undef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-/* Mutex initializers. */
-#define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } }
-#ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } }
-#endif
-
-#undef PTHREAD_RWLOCK_INITIALIZER
-#undef PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
-/* Read-write lock initializers. */
-#define PTHREAD_RWLOCK_INITIALIZER \
- { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
-#ifdef __USE_GNU
-# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,\
- 0, 0, 0 } }
-#endif /* Unix98 or XOpen2K */
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
deleted file mode 100644
index a6f9f5d433..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_broadcast.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_broadcast.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_broadcast (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_broadcast_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_broadcast
-# define __pthread_cond_broadcast __pthread_cond_broadcast_internal
-# include_next <pthread_cond_broadcast.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
deleted file mode 100644
index 49af087bb4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_destroy.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_destroy.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_destroy (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_destroy_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_destroy, pthread_cond_destroy,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_destroy
-# define __pthread_cond_destroy __pthread_cond_destroy_internal
-# include_next <pthread_cond_destroy.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
deleted file mode 100644
index ccb3de07ff..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_init.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_init.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
-{
- cond_compat_clear (cond);
- return __pthread_cond_init_internal (cond, cond_attr);
-}
-versioned_symbol (libpthread, __pthread_cond_init, pthread_cond_init,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_init
-# define __pthread_cond_init __pthread_cond_init_internal
-# include_next <pthread_cond_init.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
deleted file mode 100644
index 2bf32af933..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_signal.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_signal.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_signal (pthread_cond_t *cond)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_signal_internal (cond);
-}
-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_signal
-# define __pthread_cond_signal __pthread_cond_signal_internal
-# include_next <pthread_cond_signal.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
deleted file mode 100644
index 1cc2fc15d4..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Carlos O'Donell <carlos@codesourcery.com>, 2009.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <pthread_cond_wait.c>
-#else
-# include <pthread.h>
-# include <pthreadP.h>
-# include <internaltypes.h>
-# include <shlib-compat.h>
-int
-__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_wait_internal (cond, mutex);
-}
-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-int
-__pthread_cond_timedwait (cond, mutex, abstime)
- pthread_cond_t *cond;
- pthread_mutex_t *mutex;
- const struct timespec *abstime;
-{
- cond_compat_check_and_clear (cond);
- return __pthread_cond_timedwait_internal (cond, mutex, abstime);
-}
-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
- GLIBC_2_3_2);
-# undef versioned_symbol
-# define versioned_symbol(lib, local, symbol, version)
-# undef __pthread_cond_wait
-# define __pthread_cond_wait __pthread_cond_wait_internal
-# undef __pthread_cond_timedwait
-# define __pthread_cond_timedwait __pthread_cond_timedwait_internal
-# include_next <pthread_cond_wait.c>
-#endif
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-06-04 16:51 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 14:58 [PATCH] hppa: Use generic pthread conditional variable support John David Anglin
2017-03-12 17:59 ` Florian Weimer
2017-03-12 18:41 ` John David Anglin
2017-03-12 19:42 ` Torvald Riegel
2017-03-12 20:00 ` John David Anglin
2017-03-12 20:07 ` John David Anglin
2017-03-15 7:22 ` Mike Frysinger
2017-03-31 21:21 ` Aaro Koskinen
2017-03-31 22:35 ` John David Anglin
2017-04-01 14:01 ` [PATCH v2] hppa: Use generic pthread conditional variable support (BZ #21016) John David Anglin
2017-04-10 23:11 ` [PATCH v3] " John David Anglin
2017-06-04 16:51 ` [PATCH v4] " John David Anglin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).