x86: Remove UP macro. Define LOCK_PREFIX unconditionally.

Message ID 878sb5vbe9.fsf@oldenburg2.str.redhat.com
State New
Headers show
Series
  • x86: Remove UP macro. Define LOCK_PREFIX unconditionally.
Related show

Commit Message

Noah Goldstein via Libc-alpha Nov. 13, 2020, 9:44 a.m.
The UP macro is never defined.  Also define LOCK_PREFIX
unconditionally, to the same string.

---
 sysdeps/i386/nptl/tls.h                    | 8 +-------
 sysdeps/i386/pthread_spin_trylock.S        | 8 +-------
 sysdeps/x86/atomic-machine.h               | 8 +-------
 sysdeps/x86_64/nptl/pthread_spin_trylock.S | 8 +-------
 sysdeps/x86_64/nptl/tls.h                  | 8 +-------
 5 files changed, 5 insertions(+), 35 deletions(-)


-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill

Comments

Noah Goldstein via Libc-alpha Nov. 13, 2020, 1:40 p.m. | #1
On 13/11/2020 06:44, Florian Weimer via Libc-alpha wrote:
> The UP macro is never defined.  Also define LOCK_PREFIX

> unconditionally, to the same string.


LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>


> 

> ---

>  sysdeps/i386/nptl/tls.h                    | 8 +-------

>  sysdeps/i386/pthread_spin_trylock.S        | 8 +-------

>  sysdeps/x86/atomic-machine.h               | 8 +-------

>  sysdeps/x86_64/nptl/pthread_spin_trylock.S | 8 +-------

>  sysdeps/x86_64/nptl/tls.h                  | 8 +-------

>  5 files changed, 5 insertions(+), 35 deletions(-)

> 

> diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h

> index ec03fc189c..5042d52b98 100644

> --- a/sysdeps/i386/nptl/tls.h

> +++ b/sysdeps/i386/nptl/tls.h

> @@ -155,13 +155,7 @@ union user_desc_init

>  # define INIT_SYSINFO

>  #endif

>  

> -#ifndef LOCK_PREFIX

> -# ifdef UP

> -#  define LOCK_PREFIX  /* nothing */

> -# else

> -#  define LOCK_PREFIX "lock;"

> -# endif

> -#endif

> +#define LOCK_PREFIX "lock;"

>  

>  static inline void __attribute__ ((unused, always_inline))

>  tls_fill_user_desc (union user_desc_init *desc,

> diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S

> index 8edb676381..bdebc71f9a 100644

> --- a/sysdeps/i386/pthread_spin_trylock.S

> +++ b/sysdeps/i386/pthread_spin_trylock.S

> @@ -20,17 +20,11 @@

>  #include <errno.h>

>  

>  

> -#ifdef UP

> -# define LOCK

> -#else

> -# define LOCK lock

> -#endif

> -

>  ENTRY (pthread_spin_trylock)

>  	movl	4(%esp), %edx

>  	movl	$1, %eax

>  	xorl	%ecx, %ecx

> -	LOCK

> +	lock

>  	cmpxchgl %ecx, (%edx)

>  	movl	$EBUSY, %eax

>  #ifdef HAVE_CMOV

> diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h

> index bb49648374..7b3c81ea0f 100644

> --- a/sysdeps/x86/atomic-machine.h

> +++ b/sysdeps/x86/atomic-machine.h

> @@ -49,13 +49,7 @@ typedef intmax_t atomic_max_t;

>  typedef uintmax_t uatomic_max_t;

>  

>  

> -#ifndef LOCK_PREFIX

> -# ifdef UP

> -#  define LOCK_PREFIX	/* nothing */

> -# else

> -#  define LOCK_PREFIX "lock;"

> -# endif

> -#endif

> +#define LOCK_PREFIX "lock;"

>  

>  #define USE_ATOMIC_COMPILER_BUILTINS	1

>  

> diff --git a/sysdeps/x86_64/nptl/pthread_spin_trylock.S b/sysdeps/x86_64/nptl/pthread_spin_trylock.S

> index c084577755..84c9b41448 100644

> --- a/sysdeps/x86_64/nptl/pthread_spin_trylock.S

> +++ b/sysdeps/x86_64/nptl/pthread_spin_trylock.S

> @@ -20,16 +20,10 @@

>  #include <errno.h>

>  

>  

> -#ifdef UP

> -# define LOCK

> -#else

> -# define LOCK lock

> -#endif

> -

>  ENTRY(pthread_spin_trylock)

>  	movl	$1, %eax

>  	xorl	%ecx, %ecx

> -	LOCK

> +	lock

>  	cmpxchgl %ecx, (%rdi)

>  	movl	$EBUSY, %eax

>  	cmovel	%ecx, %eax

> diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h

> index 7ba9c4e69b..fbd7f9cb89 100644

> --- a/sysdeps/x86_64/nptl/tls.h

> +++ b/sysdeps/x86_64/nptl/tls.h

> @@ -99,13 +99,7 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,

>  /* Get system call information.  */

>  # include <sysdep.h>

>  

> -#ifndef LOCK_PREFIX

> -# ifdef UP

> -#  define LOCK_PREFIX	/* nothing */

> -# else

> -#  define LOCK_PREFIX	"lock;"

> -# endif

> -#endif

> +#define LOCK_PREFIX "lock;"

>  

>  /* This is the size of the initial TCB.  Can't be just sizeof (tcbhead_t),

>     because NPTL getpid, __libc_alloca_cutoff etc. need (almost) the whole

>

Patch

diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h
index ec03fc189c..5042d52b98 100644
--- a/sysdeps/i386/nptl/tls.h
+++ b/sysdeps/i386/nptl/tls.h
@@ -155,13 +155,7 @@  union user_desc_init
 # define INIT_SYSINFO
 #endif
 
-#ifndef LOCK_PREFIX
-# ifdef UP
-#  define LOCK_PREFIX  /* nothing */
-# else
-#  define LOCK_PREFIX "lock;"
-# endif
-#endif
+#define LOCK_PREFIX "lock;"
 
 static inline void __attribute__ ((unused, always_inline))
 tls_fill_user_desc (union user_desc_init *desc,
diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S
index 8edb676381..bdebc71f9a 100644
--- a/sysdeps/i386/pthread_spin_trylock.S
+++ b/sysdeps/i386/pthread_spin_trylock.S
@@ -20,17 +20,11 @@ 
 #include <errno.h>
 
 
-#ifdef UP
-# define LOCK
-#else
-# define LOCK lock
-#endif
-
 ENTRY (pthread_spin_trylock)
 	movl	4(%esp), %edx
 	movl	$1, %eax
 	xorl	%ecx, %ecx
-	LOCK
+	lock
 	cmpxchgl %ecx, (%edx)
 	movl	$EBUSY, %eax
 #ifdef HAVE_CMOV
diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
index bb49648374..7b3c81ea0f 100644
--- a/sysdeps/x86/atomic-machine.h
+++ b/sysdeps/x86/atomic-machine.h
@@ -49,13 +49,7 @@  typedef intmax_t atomic_max_t;
 typedef uintmax_t uatomic_max_t;
 
 
-#ifndef LOCK_PREFIX
-# ifdef UP
-#  define LOCK_PREFIX	/* nothing */
-# else
-#  define LOCK_PREFIX "lock;"
-# endif
-#endif
+#define LOCK_PREFIX "lock;"
 
 #define USE_ATOMIC_COMPILER_BUILTINS	1
 
diff --git a/sysdeps/x86_64/nptl/pthread_spin_trylock.S b/sysdeps/x86_64/nptl/pthread_spin_trylock.S
index c084577755..84c9b41448 100644
--- a/sysdeps/x86_64/nptl/pthread_spin_trylock.S
+++ b/sysdeps/x86_64/nptl/pthread_spin_trylock.S
@@ -20,16 +20,10 @@ 
 #include <errno.h>
 
 
-#ifdef UP
-# define LOCK
-#else
-# define LOCK lock
-#endif
-
 ENTRY(pthread_spin_trylock)
 	movl	$1, %eax
 	xorl	%ecx, %ecx
-	LOCK
+	lock
 	cmpxchgl %ecx, (%rdi)
 	movl	$EBUSY, %eax
 	cmovel	%ecx, %eax
diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h
index 7ba9c4e69b..fbd7f9cb89 100644
--- a/sysdeps/x86_64/nptl/tls.h
+++ b/sysdeps/x86_64/nptl/tls.h
@@ -99,13 +99,7 @@  _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
 /* Get system call information.  */
 # include <sysdep.h>
 
-#ifndef LOCK_PREFIX
-# ifdef UP
-#  define LOCK_PREFIX	/* nothing */
-# else
-#  define LOCK_PREFIX	"lock;"
-# endif
-#endif
+#define LOCK_PREFIX "lock;"
 
 /* This is the size of the initial TCB.  Can't be just sizeof (tcbhead_t),
    because NPTL getpid, __libc_alloca_cutoff etc. need (almost) the whole