[glibc] 01/01: hurd: make spinlocks use gsync too
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch sid
in repository glibc.
commit ce63088234256b5da942b51bd81f52877045ad9f
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Mon Oct 24 09:53:54 2016 +0000
hurd: make spinlocks use gsync too
hurd-i386/tg-libpthread-gsync-spin.diff: New patch
---
debian/changelog | 2 +
.../hurd-i386/tg-libpthread-gsync-spin.diff | 350 +++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 353 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 6f40928..ab5fc46 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ glibc (2.24-6) UNRELEASED; urgency=medium
- hurd-i386/cvs-libpthread-static-weak.diff: Drop, merged upstream.
- hurd-i386/cvs-pthread-atfork.diff: Drop, merged upstream.
- hurd-i386/cvs-setcancelstate.diff: Drop, merged upstream.
+ * hurd-i386/tg-libpthread-gsync-spin.diff: New patch to make spinlocks use
+ gsync too.
-- Aurelien Jarno <aurel32@debian.org> Tue, 18 Oct 2016 23:17:42 +0200
diff --git a/debian/patches/hurd-i386/tg-libpthread-gsync-spin.diff b/debian/patches/hurd-i386/tg-libpthread-gsync-spin.diff
new file mode 100644
index 0000000..8969d0c
--- /dev/null
+++ b/debian/patches/hurd-i386/tg-libpthread-gsync-spin.diff
@@ -0,0 +1,350 @@
+commit 766852102c4b9a720fa5c9cd668417ffeb2bcba6
+Author: Agustina Arzille <avarzille@riseup.net>
+Date: Tue Oct 18 00:20:45 2016 +0200
+
+ Make pthread_spinlock use gsync
+
+diff --git a/libpthread/Makefile b/libpthread/Makefile
+index 21c9b94..6329d9d 100644
+--- a/libpthread/Makefile
++++ b/libpthread/Makefile
+@@ -132,7 +132,6 @@ libpthread-routines := pt-attr pt-attr-destroy pt-attr-getdetachstate \
+ pt-sysdep \
+ pt-setup \
+ pt-machdep \
+- pt-spin \
+ \
+ pt-sigstate-init \
+ pt-sigstate-destroy \
+diff --git a/libpthread/pthread/pt-spin-inlines.c b/libpthread/pthread/pt-spin-inlines.c
+index cfb21dd..4dc484e 100644
+--- a/libpthread/pthread/pt-spin-inlines.c
++++ b/libpthread/pthread/pt-spin-inlines.c
+@@ -31,4 +31,8 @@
+ weak_alias (__pthread_spin_destroy, pthread_spin_destroy);
+ weak_alias (__pthread_spin_init, pthread_spin_init);
+ weak_alias (__pthread_spin_trylock, pthread_spin_trylock);
++weak_alias (__pthread_spin_lock, pthread_spin_lock);
+ weak_alias (__pthread_spin_unlock, pthread_spin_unlock);
++
++/* Compatibility with old non-gsync spinlocks */
++weak_alias (__pthread_spin_lock, _pthread_spin_lock);
+diff --git a/libpthread/sysdeps/mach/bits/spin-lock-inline.h b/libpthread/sysdeps/mach/bits/spin-lock-inline.h
+index f9f7c29..98e4b3b 100644
+--- a/libpthread/sysdeps/mach/bits/spin-lock-inline.h
++++ b/libpthread/sysdeps/mach/bits/spin-lock-inline.h
+@@ -22,7 +22,7 @@
+
+ #include <features.h>
+ #include <bits/spin-lock.h>
+-#include <machine-lock.h> /* This does all the work. */
++#include <lock-intern.h> /* This does all the work. */
+
+ __BEGIN_DECLS
+
+@@ -60,17 +60,15 @@ __PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock);
+ __PT_SPIN_INLINE int
+ __pthread_spin_trylock (__pthread_spinlock_t *__lock)
+ {
+- return __spin_try_lock (__lock) ? 0 : __EBUSY;
++ return __spin_try_lock ((__spin_lock_t *) __lock) ? 0 : __EBUSY;
+ }
+
+-__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock);
+-extern int _pthread_spin_lock (__pthread_spinlock_t *__lock);
++__PT_SPIN_INLINE int __pthread_spin_lock (__pthread_spinlock_t *__lock);
+
+-__extern_inline int
++__PT_SPIN_INLINE int
+ __pthread_spin_lock (__pthread_spinlock_t *__lock)
+ {
+- if (__pthread_spin_trylock (__lock))
+- return _pthread_spin_lock (__lock);
++ __spin_lock ((__spin_lock_t *) __lock);
+ return 0;
+ }
+
+@@ -79,7 +77,7 @@ __PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock);
+ __PT_SPIN_INLINE int
+ __pthread_spin_unlock (__pthread_spinlock_t *__lock)
+ {
+- __spin_unlock (__lock);
++ __spin_unlock ((__spin_lock_t *) __lock);
+ return 0;
+ }
+
+diff --git a/libpthread/sysdeps/mach/bits/spin-lock.h b/libpthread/sysdeps/mach/bits/spin-lock.h
+index 537dac9..7574b37 100644
+--- a/libpthread/sysdeps/mach/bits/spin-lock.h
++++ b/libpthread/sysdeps/mach/bits/spin-lock.h
+@@ -21,17 +21,14 @@
+ #define _BITS_SPIN_LOCK_H 1
+
+ #include <features.h>
+-#include <machine-lock.h> /* This does all the work. */
+
+ __BEGIN_DECLS
+
+ /* The type of a spin lock object. */
+-typedef __spin_lock_t __pthread_spinlock_t;
++typedef volatile int __pthread_spinlock_t;
+
+ /* Initializer for a spin lock object. */
+-#ifndef __PTHREAD_SPIN_LOCK_INITIALIZER
+-#error __PTHREAD_SPIN_LOCK_INITIALIZER undefined: should be defined by <lock-intern.h>.
+-#endif
++#define __PTHREAD_SPIN_LOCK_INITIALIZER 0
+
+ __END_DECLS
+
+diff --git a/libpthread/sysdeps/mach/i386/bits/spin-lock-inline.h b/libpthread/sysdeps/mach/i386/bits/spin-lock-inline.h
+deleted file mode 100644
+index e5ed3de..0000000
+--- a/libpthread/sysdeps/mach/i386/bits/spin-lock-inline.h
++++ /dev/null
+@@ -1,98 +0,0 @@
+-/* Machine-specific definitions for spin locks. i386 version.
+- Copyright (C) 2000, 2005, 2008, 2009 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Library General Public License as
+- published by the Free Software Foundation; either version 2 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
+- Library General Public License for more details.
+-
+- You should have received a copy of the GNU Library General Public
+- License along with the GNU C Library; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-/*
+- * Never include this file directly; use <pthread.h> or <cthreads.h> instead.
+- */
+-
+-#ifndef _BITS_SPIN_LOCK_INLINE_H
+-#define _BITS_SPIN_LOCK_INLINE_H 1
+-
+-#include <features.h>
+-#include <bits/spin-lock.h>
+-
+-__BEGIN_DECLS
+-
+-#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES
+-
+-# ifndef __EBUSY
+-# include <errno.h>
+-# define __EBUSY EBUSY
+-# endif
+-
+-# ifndef __PT_SPIN_INLINE
+-# define __PT_SPIN_INLINE __extern_inline
+-# endif
+-
+-__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock);
+-
+-__PT_SPIN_INLINE int
+-__pthread_spin_destroy (__pthread_spinlock_t *__lock)
+-{
+- return 0;
+-}
+-
+-__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock,
+- int __pshared);
+-
+-__PT_SPIN_INLINE int
+-__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared)
+-{
+- *__lock = __PTHREAD_SPIN_LOCK_INITIALIZER;
+- return 0;
+-}
+-
+-__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock);
+-
+-__PT_SPIN_INLINE int
+-__pthread_spin_trylock (__pthread_spinlock_t *__lock)
+-{
+- int __locked;
+- __asm__ __volatile ("xchgl %0, %1"
+- : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory");
+- return __locked ? __EBUSY : 0;
+-}
+-
+-__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock);
+-extern int _pthread_spin_lock (__pthread_spinlock_t *__lock);
+-
+-__extern_inline int
+-__pthread_spin_lock (__pthread_spinlock_t *__lock)
+-{
+- if (__pthread_spin_trylock (__lock))
+- return _pthread_spin_lock (__lock);
+- return 0;
+-}
+-
+-__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock);
+-
+-__PT_SPIN_INLINE int
+-__pthread_spin_unlock (__pthread_spinlock_t *__lock)
+-{
+- int __unlocked;
+- __asm__ __volatile ("xchgl %0, %1"
+- : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory");
+- return 0;
+-}
+-
+-#endif /* Use extern inlines or force inlines. */
+-
+-__END_DECLS
+-
+-#endif /* bits/spin-lock.h */
+diff --git a/libpthread/sysdeps/mach/i386/bits/spin-lock.h b/libpthread/sysdeps/mach/i386/bits/spin-lock.h
+deleted file mode 100644
+index 5ae81e1..0000000
+--- a/libpthread/sysdeps/mach/i386/bits/spin-lock.h
++++ /dev/null
+@@ -1,39 +0,0 @@
+-/* Machine-specific definitions for spin locks. i386 version.
+- Copyright (C) 2000, 2005, 2008, 2009 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Library General Public License as
+- published by the Free Software Foundation; either version 2 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
+- Library General Public License for more details.
+-
+- You should have received a copy of the GNU Library General Public
+- License along with the GNU C Library; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-/*
+- * Never include this file directly; use <pthread.h> or <cthreads.h> instead.
+- */
+-
+-#ifndef _BITS_SPIN_LOCK_H
+-#define _BITS_SPIN_LOCK_H 1
+-
+-#include <features.h>
+-
+-__BEGIN_DECLS
+-
+-/* The type of a spin lock object. */
+-typedef __volatile int __pthread_spinlock_t;
+-
+-/* Initializer for a spin lock object. */
+-# define __PTHREAD_SPIN_LOCK_INITIALIZER ((__pthread_spinlock_t) 0)
+-
+-__END_DECLS
+-
+-#endif /* bits/spin-lock.h */
+diff --git a/libpthread/sysdeps/mach/pt-spin.c b/libpthread/sysdeps/mach/pt-spin.c
+deleted file mode 100644
+index d9a2a32..0000000
+--- a/libpthread/sysdeps/mach/pt-spin.c
++++ /dev/null
+@@ -1,36 +0,0 @@
+-/* Spin locks. Mach version.
+- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Library General Public License as
+- published by the Free Software Foundation; either version 2 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
+- Library General Public License for more details.
+-
+- You should have received a copy of the GNU Library General Public
+- License along with the GNU C Library; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-#include <pthread.h>
+-#include <machine-lock.h>
+-
+-/* In glibc. */
+-extern void __spin_lock_solid (__pthread_spinlock_t *lock);
+-
+-/* Lock the spin lock object LOCK. If the lock is held by another
+- thread spin until it becomes available. */
+-int
+-_pthread_spin_lock (__pthread_spinlock_t *lock)
+-{
+- __spin_lock_solid (lock);
+- return 0;
+-}
+-
+-weak_alias (_pthread_spin_lock, pthread_spin_lock);
+-weak_alias (_pthread_spin_lock, __pthread_spin_lock);
+diff --git a/libpthread/sysdeps/posix/pt-spin.c b/libpthread/sysdeps/posix/pt-spin.c
+deleted file mode 100644
+index cb809c6..0000000
+--- a/libpthread/sysdeps/posix/pt-spin.c
++++ /dev/null
+@@ -1,54 +0,0 @@
+-/* Spin locks.
+- Copyright (C) 2000, 2004, 2005 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Library General Public License as
+- published by the Free Software Foundation; either version 2 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
+- Library General Public License for more details.
+-
+- You should have received a copy of the GNU Library General Public
+- License along with the GNU C Library; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-#include <pthread.h>
+-#include <sched.h>
+-
+-/* The default for single processor machines; don't spin, it's
+- pointless. */
+-#ifndef __PTHREAD_SPIN_COUNT
+-# define __PTHREAD_SPIN_COUNT 1
+-#endif
+-
+-/* The number of times to spin while trying to lock a spin lock object
+- before yielding the processor. */
+-int __pthread_spin_count = __PTHREAD_SPIN_COUNT;
+-
+-
+-/* Lock the spin lock object LOCK. If the lock is held by another
+- thread spin until it becomes available. */
+-int
+-_pthread_spin_lock (__pthread_spinlock_t *lock)
+-{
+- int i;
+-
+- while (1)
+- {
+- for (i = 0; i < __pthread_spin_count; i++)
+- {
+- if (__pthread_spin_trylock (lock) == 0)
+- return 0;
+- }
+-
+- __sched_yield ();
+- }
+-}
+-
+-weak_alias (_pthread_spin_lock, pthread_spin_lock);
+-weak_alias (_pthread_spin_lock, __pthread_spin_lock);
diff --git a/debian/patches/series b/debian/patches/series
index 0892eaf..9f60b1d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -132,6 +132,7 @@ hurd-i386/tg-gsync-libc.diff
hurd-i386/cvs-adjtime-NULL.diff
hurd-i386/tg-pthread_deps.diff
hurd-i386/cvs-mallocfork.diff
+hurd-i386/tg-libpthread-gsync-spin.diff
i386/local-biarch.diff
i386/local-cmov.diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git
Reply to: