Hello,

So Svante seems to have issues with the upcoming libc 2.24-6, and we're
suspecting the gsync-spin patch as potential culprit.  I have found at
least one issue with it which might be related (though I'm wondering how
it could).  I have attached a fixed version, could you check that it
solves your issue?

Samuel
commit 4885bbdb5a271ca3ce94282d7d24b9651c02513b
Author: Agustina Arzille <avarzi...@riseup.net>
Date:   Tue Oct 18 00:20:45 2016 +0200

    Make pthread_spinlock use gsync

diff --git a/libpthread/pthread/pt-spin-inlines.c 
b/libpthread/pthread/pt-spin-inlines.c
index cfb21dd..f905065 100644
--- a/libpthread/pthread/pt-spin-inlines.c
+++ b/libpthread/pthread/pt-spin-inlines.c
@@ -31,4 +31,5 @@
 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);
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);

Reply via email to