diff mbox

[v2] Consolidate sched_getcpu

Message ID 5571F16E.3000509@linaro.org
State New
Headers show

Commit Message

Adhemerval Zanella Netto June 5, 2015, 6:58 p.m. UTC
This is an update patch for my previous one [1] to consolidates 
sched_getcpu implementations across all arches (except tile, 
which requires its own).  This patch removes the powerpc, x86_64
and x32 specific files and change the default linux one to use 
INLINE_VSYSCALL where possible (for ports that implements it).

Tested on powerpc64, i386, x86_64, and x32.

[1] https://sourceware.org/ml/libc-alpha/2015-04/msg00290.html

Changes from previous version:

* Do not remove __syscall_clock_gettime for x86_64 (it will be
  in another cleanup).

--

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
	(HAVE_GETCPU_VSYSCALL): Define.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
	(HAVE_GETCPU_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c: Remove file.
	* sysdeps/unix/sysv/linux/sched_getcpu.c
	(HAVE_VSYSCALL) [HAVE_GETCPU_VSYSCALL]: Define.
	(sched_getcpu): Use INLINE_VSYSCALL instead of INLINE_SYSCALL.
	* sysdeps/unix/sysv/linux/x86/libc-vdso.h (getcpu): Add vDSO
	prototype.
	* sysdeps/unix/sysv/linux/x86_64/init-first.c
	(__vdso_platform_setup): Remove vsyscall getcpu fallback.
	* sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S: Remove file.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_GETCPU_VSYSCALL):
	Define.
	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile: Remove file.
	* sysdeps/unix/sysv/linux/x86_64/x32/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S: Likewise.

---

Comments

Adhemerval Zanella Netto June 9, 2015, 2:26 p.m. UTC | #1
I will commit this patch soon if noone opposes it.

On 05-06-2015 15:58, Adhemerval Zanella wrote:
> This is an update patch for my previous one [1] to consolidates 
> sched_getcpu implementations across all arches (except tile, 
> which requires its own).  This patch removes the powerpc, x86_64
> and x32 specific files and change the default linux one to use 
> INLINE_VSYSCALL where possible (for ports that implements it).
> 
> Tested on powerpc64, i386, x86_64, and x32.
> 
> [1] https://sourceware.org/ml/libc-alpha/2015-04/msg00290.html
> 
> Changes from previous version:
> 
> * Do not remove __syscall_clock_gettime for x86_64 (it will be
>   in another cleanup).
> 
> --
> 
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
> 	(HAVE_GETCPU_VSYSCALL): Define.
> 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
> 	(HAVE_GETCPU_VSYSCALL): Likewise.
> 	* sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c: Remove file.
> 	* sysdeps/unix/sysv/linux/sched_getcpu.c
> 	(HAVE_VSYSCALL) [HAVE_GETCPU_VSYSCALL]: Define.
> 	(sched_getcpu): Use INLINE_VSYSCALL instead of INLINE_SYSCALL.
> 	* sysdeps/unix/sysv/linux/x86/libc-vdso.h (getcpu): Add vDSO
> 	prototype.
> 	* sysdeps/unix/sysv/linux/x86_64/init-first.c
> 	(__vdso_platform_setup): Remove vsyscall getcpu fallback.
> 	* sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S: Remove file.
> 	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_GETCPU_VSYSCALL):
> 	Define.
> 	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile: Remove file.
> 	* sysdeps/unix/sysv/linux/x86_64/x32/init-first.c: Likewise.
> 	* sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c: Likewise.
> 	* sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S: Likewise.
> 
> ---
> 
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
> index cbce324..dc56bea 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
> @@ -165,6 +165,7 @@
>  /* List of system calls which are supported as vsyscalls.  */
>  # define HAVE_CLOCK_GETRES_VSYSCALL	1
>  # define HAVE_CLOCK_GETTIME_VSYSCALL	1
> +# define HAVE_GETCPU_VSYSCALL		1
>  
>  
>  # define LOADARGS_0(name, dummy)					      \
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
> index a727f38..e2014cc 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
> @@ -80,6 +80,7 @@
>  /* List of system calls which are supported as vsyscalls.  */
>  #define HAVE_CLOCK_GETRES_VSYSCALL	1
>  #define HAVE_CLOCK_GETTIME_VSYSCALL	1
> +#define HAVE_GETCPU_VSYSCALL		1
>  
>  /* Define a macro which expands inline into the wrapper code for a system
>     call. This use is for internal calls that do not need to handle errors
> diff --git a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
> deleted file mode 100644
> index f93be01..0000000
> --- a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* Copyright (C) 2013-2015 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 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/>.  */
> -
> -#include <sched.h>
> -#include <sysdep.h>
> -#include <sysdep-vdso.h>
> -
> -int
> -sched_getcpu (void)
> -{
> -  unsigned int cpu;
> -  int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
> -
> -  return r == -1 ? r : cpu;
> -}
> diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c
> index 09f0816..a485d36 100644
> --- a/sysdeps/unix/sysv/linux/sched_getcpu.c
> +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c
> @@ -19,13 +19,17 @@
>  #include <sched.h>
>  #include <sysdep.h>
>  
> +#ifdef HAVE_GETCPU_VSYSCALL
> +# define HAVE_VSYSCALL
> +#endif
> +#include <sysdep-vdso.h>
>  
>  int
>  sched_getcpu (void)
>  {
>  #ifdef __NR_getcpu
>    unsigned int cpu;
> -  int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
> +  int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
>  
>    return r == -1 ? r : cpu;
>  #else
> diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> index fea9c2b..f3a8f07 100644
> --- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> +++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> @@ -29,6 +29,8 @@
>  extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
>    attribute_hidden;
>  
> +extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *);
> +
>  #endif
>  
>  #endif /* _LIBC_VDSO_H */
> diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
> index b7bdbd1..6e2b040 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
> +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
> @@ -42,10 +42,6 @@ __vdso_platform_setup (void)
>    VDSO_SYMBOL(clock_gettime) = p;
>  
>    p = _dl_vdso_vsym ("__vdso_getcpu", &linux26);
> -  /* If the vDSO is not available we fall back on the old vsyscall.  */
> -#define VSYSCALL_ADDR_vgetcpu	0xffffffffff600800
> -  if (p == NULL)
> -    p = (void *) VSYSCALL_ADDR_vgetcpu;
>    PTR_MANGLE (p);
>    VDSO_SYMBOL(getcpu) = p;
>  }
> diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
> deleted file mode 100644
> index b87f803..0000000
> --- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -/* Copyright (C) 2007-2015 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 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/>.  */
> -
> -#include <sysdep.h>
> -#include <tls.h>
> -#define _ERRNO_H	1
> -#include <bits/errno.h>
> -#include <kernel-features.h>
> -
> -/* For the calculation see asm/vsyscall.h.  */
> -#define VSYSCALL_ADDR_vgetcpu	0xffffffffff600800
> -
> -
> -ENTRY (sched_getcpu)
> -	/* Align stack and create local variable for result.  */
> -	sub	$0x8, %rsp
> -	cfi_adjust_cfa_offset(8)
> -
> -	movq	%rsp, %rdi
> -	xorl	%esi, %esi
> -	movl	$VGETCPU_CACHE_OFFSET, %edx
> -	addq	%fs:0, %rdx
> -
> -#ifdef SHARED
> -	movq	__vdso_getcpu(%rip), %rax
> -	PTR_DEMANGLE (%rax)
> -	callq	*%rax
> -#else
> -# ifdef __NR_getcpu
> -	movl	$__NR_getcpu, %eax
> -	syscall
> -#  ifndef __ASSUME_GETCPU_SYSCALL
> -	cmpq	$-ENOSYS, %rax
> -	jne	1f
> -#  endif
> -# endif
> -# ifndef __ASSUME_GETCPU_SYSCALL
> -	movq	$VSYSCALL_ADDR_vgetcpu, %rax
> -	callq	*%rax
> -1:
> -# else
> -#  ifndef __NR_getcpu
> -#   error "cannot happen"
> -#  endif
> -# endif
> -#endif
> -
> -	/* Local variable is result if the call is successful.  */
> -	movl	(%rsp), %edx
> -	/* Restore stack pointer before we might jump to
> -	SYSCALL_ERROR_LABEL which returns to the caller.  */
> -	add	$0x8, %rsp
> -	cfi_adjust_cfa_offset(-8)
> -
> -	cmpq	$-4095, %rax
> -	jae	SYSCALL_ERROR_LABEL
> -
> -	movl	%edx, %eax
> -	ret
> -PSEUDO_END(sched_getcpu)
> diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> index bea3192..5a62cce 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> @@ -255,6 +255,7 @@
>  /* List of system calls which are supported as vsyscalls.  */
>  # define HAVE_CLOCK_GETTIME_VSYSCALL    1
>  # define HAVE_GETTIMEOFDAY_VSYSCALL     1
> +# define HAVE_GETCPU_VSYSCALL		1
>  
>  # define LOAD_ARGS_0()
>  # define LOAD_REGS_0
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
> index ecbdefb..8c3253b 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
> +++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
> @@ -4,7 +4,3 @@ default-abi := x32
>  ifeq ($(subdir),misc)
>  sysdep_routines += arch_prctl
>  endif
> -
> -ifeq ($(subdir),posix)
> -sysdep_routines += getcpu sched_getcpu-static
> -endif
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
> deleted file mode 100644
> index 31ec80f..0000000
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* Initialization code run first thing by the ELF startup code.  Linux/x32.
> -   Copyright (C) 2012-2015 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 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/>.  */
> -
> -#ifdef SHARED
> -# include <dl-vdso.h>
> -# include <libc-vdso.h>
> -
> -long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
> -  attribute_hidden;
> -
> -static inline void
> -_libc_vdso_platform_setup (void)
> -{
> -  PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
> -
> -  void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
> -  PTR_MANGLE (p);
> -  __vdso_clock_gettime = p;
> -}
> -
> -# define VDSO_SETUP _libc_vdso_platform_setup
> -#endif
> -
> -#include <csu/init-first.c>
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
> deleted file mode 100644
> index 38bbf9a..0000000
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#ifndef SHARED
> -#include "../../sched_getcpu.c"
> -#endif
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
> deleted file mode 100644
> index 35ad01b..0000000
> --- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -/* Copyright (C) 2012-2015 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 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/>.  */
> -
> -#ifdef SHARED
> -#include <sysdep.h>
> -#include <tls.h>
> -#define _ERRNO_H	1
> -#include <bits/errno.h>
> -
> -ENTRY (sched_getcpu)
> -	/* Align stack and create local variable for result.  */
> -	sub	$0x8, %esp
> -	cfi_adjust_cfa_offset(8)
> -
> -	mov	%esp, %edi
> -	xor	%esi, %esi
> -	mov	$VGETCPU_CACHE_OFFSET, %edx
> -	add	%fs:0, %edx
> -
> -	call	__getcpu
> -
> -	/* Local variable is result if the call is successful.  */
> -	mov	(%rsp), %edx
> -	/* Restore stack pointer before we might jump to
> -	   SYSCALL_ERROR_LABEL which returns to the caller.  */
> -	add	$0x8, %esp
> -	cfi_adjust_cfa_offset(-8)
> -
> -	cmp	$-4095, %eax
> -	jae	SYSCALL_ERROR_LABEL
> -
> -	mov	%edx, %eax
> -	ret
> -PSEUDO_END(sched_getcpu)
> -#endif
>
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index cbce324..dc56bea 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -165,6 +165,7 @@ 
 /* List of system calls which are supported as vsyscalls.  */
 # define HAVE_CLOCK_GETRES_VSYSCALL	1
 # define HAVE_CLOCK_GETTIME_VSYSCALL	1
+# define HAVE_GETCPU_VSYSCALL		1
 
 
 # define LOADARGS_0(name, dummy)					      \
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index a727f38..e2014cc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -80,6 +80,7 @@ 
 /* List of system calls which are supported as vsyscalls.  */
 #define HAVE_CLOCK_GETRES_VSYSCALL	1
 #define HAVE_CLOCK_GETTIME_VSYSCALL	1
+#define HAVE_GETCPU_VSYSCALL		1
 
 /* Define a macro which expands inline into the wrapper code for a system
    call. This use is for internal calls that do not need to handle errors
diff --git a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
deleted file mode 100644
index f93be01..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
+++ /dev/null
@@ -1,29 +0,0 @@ 
-/* Copyright (C) 2013-2015 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 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/>.  */
-
-#include <sched.h>
-#include <sysdep.h>
-#include <sysdep-vdso.h>
-
-int
-sched_getcpu (void)
-{
-  unsigned int cpu;
-  int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
-
-  return r == -1 ? r : cpu;
-}
diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c
index 09f0816..a485d36 100644
--- a/sysdeps/unix/sysv/linux/sched_getcpu.c
+++ b/sysdeps/unix/sysv/linux/sched_getcpu.c
@@ -19,13 +19,17 @@ 
 #include <sched.h>
 #include <sysdep.h>
 
+#ifdef HAVE_GETCPU_VSYSCALL
+# define HAVE_VSYSCALL
+#endif
+#include <sysdep-vdso.h>
 
 int
 sched_getcpu (void)
 {
 #ifdef __NR_getcpu
   unsigned int cpu;
-  int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
+  int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
 
   return r == -1 ? r : cpu;
 #else
diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
index fea9c2b..f3a8f07 100644
--- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
@@ -29,6 +29,8 @@ 
 extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
 
+extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *);
+
 #endif
 
 #endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index b7bdbd1..6e2b040 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -42,10 +42,6 @@  __vdso_platform_setup (void)
   VDSO_SYMBOL(clock_gettime) = p;
 
   p = _dl_vdso_vsym ("__vdso_getcpu", &linux26);
-  /* If the vDSO is not available we fall back on the old vsyscall.  */
-#define VSYSCALL_ADDR_vgetcpu	0xffffffffff600800
-  if (p == NULL)
-    p = (void *) VSYSCALL_ADDR_vgetcpu;
   PTR_MANGLE (p);
   VDSO_SYMBOL(getcpu) = p;
 }
diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
deleted file mode 100644
index b87f803..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
+++ /dev/null
@@ -1,74 +0,0 @@ 
-/* Copyright (C) 2007-2015 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 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/>.  */
-
-#include <sysdep.h>
-#include <tls.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-#include <kernel-features.h>
-
-/* For the calculation see asm/vsyscall.h.  */
-#define VSYSCALL_ADDR_vgetcpu	0xffffffffff600800
-
-
-ENTRY (sched_getcpu)
-	/* Align stack and create local variable for result.  */
-	sub	$0x8, %rsp
-	cfi_adjust_cfa_offset(8)
-
-	movq	%rsp, %rdi
-	xorl	%esi, %esi
-	movl	$VGETCPU_CACHE_OFFSET, %edx
-	addq	%fs:0, %rdx
-
-#ifdef SHARED
-	movq	__vdso_getcpu(%rip), %rax
-	PTR_DEMANGLE (%rax)
-	callq	*%rax
-#else
-# ifdef __NR_getcpu
-	movl	$__NR_getcpu, %eax
-	syscall
-#  ifndef __ASSUME_GETCPU_SYSCALL
-	cmpq	$-ENOSYS, %rax
-	jne	1f
-#  endif
-# endif
-# ifndef __ASSUME_GETCPU_SYSCALL
-	movq	$VSYSCALL_ADDR_vgetcpu, %rax
-	callq	*%rax
-1:
-# else
-#  ifndef __NR_getcpu
-#   error "cannot happen"
-#  endif
-# endif
-#endif
-
-	/* Local variable is result if the call is successful.  */
-	movl	(%rsp), %edx
-	/* Restore stack pointer before we might jump to
-	SYSCALL_ERROR_LABEL which returns to the caller.  */
-	add	$0x8, %rsp
-	cfi_adjust_cfa_offset(-8)
-
-	cmpq	$-4095, %rax
-	jae	SYSCALL_ERROR_LABEL
-
-	movl	%edx, %eax
-	ret
-PSEUDO_END(sched_getcpu)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index bea3192..5a62cce 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -255,6 +255,7 @@ 
 /* List of system calls which are supported as vsyscalls.  */
 # define HAVE_CLOCK_GETTIME_VSYSCALL    1
 # define HAVE_GETTIMEOFDAY_VSYSCALL     1
+# define HAVE_GETCPU_VSYSCALL		1
 
 # define LOAD_ARGS_0()
 # define LOAD_REGS_0
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
index ecbdefb..8c3253b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
@@ -4,7 +4,3 @@  default-abi := x32
 ifeq ($(subdir),misc)
 sysdep_routines += arch_prctl
 endif
-
-ifeq ($(subdir),posix)
-sysdep_routines += getcpu sched_getcpu-static
-endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
deleted file mode 100644
index 31ec80f..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
+++ /dev/null
@@ -1,39 +0,0 @@ 
-/* Initialization code run first thing by the ELF startup code.  Linux/x32.
-   Copyright (C) 2012-2015 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 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/>.  */
-
-#ifdef SHARED
-# include <dl-vdso.h>
-# include <libc-vdso.h>
-
-long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
-  attribute_hidden;
-
-static inline void
-_libc_vdso_platform_setup (void)
-{
-  PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
-
-  void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
-  PTR_MANGLE (p);
-  __vdso_clock_gettime = p;
-}
-
-# define VDSO_SETUP _libc_vdso_platform_setup
-#endif
-
-#include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
deleted file mode 100644
index 38bbf9a..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
+++ /dev/null
@@ -1,3 +0,0 @@ 
-#ifndef SHARED
-#include "../../sched_getcpu.c"
-#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
deleted file mode 100644
index 35ad01b..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
+++ /dev/null
@@ -1,49 +0,0 @@ 
-/* Copyright (C) 2012-2015 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 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/>.  */
-
-#ifdef SHARED
-#include <sysdep.h>
-#include <tls.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-ENTRY (sched_getcpu)
-	/* Align stack and create local variable for result.  */
-	sub	$0x8, %esp
-	cfi_adjust_cfa_offset(8)
-
-	mov	%esp, %edi
-	xor	%esi, %esi
-	mov	$VGETCPU_CACHE_OFFSET, %edx
-	add	%fs:0, %edx
-
-	call	__getcpu
-
-	/* Local variable is result if the call is successful.  */
-	mov	(%rsp), %edx
-	/* Restore stack pointer before we might jump to
-	   SYSCALL_ERROR_LABEL which returns to the caller.  */
-	add	$0x8, %esp
-	cfi_adjust_cfa_offset(-8)
-
-	cmp	$-4095, %eax
-	jae	SYSCALL_ERROR_LABEL
-
-	mov	%edx, %eax
-	ret
-PSEUDO_END(sched_getcpu)
-#endif