mbox series

[00/14] Remove sysdep-cancel assembly macro

Message ID 1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org
Headers show
Series Remove sysdep-cancel assembly macro | expand

Message

Adhemerval Zanella July 4, 2017, 7:53 p.m. UTC
- I refactored how internal non cancellable syscalls are implemented
    within glibc.  On Linux which support cancellation instead of
    C prepocessor macros, proper function prototypes and implementation
    are used.  This allows targets that requires specific handling of
    64 bits arguments, such as x32, to use the correct kernel abi.

--

This patchset finishes my previous work of Linux syscall consolidation
and refactor to finally remove the requeriment of sysdeps-cancel.h
assembly macros for cancellable syscalls.  All ports now uses the
SYSCALL_CANCEL macros with C implementation which in turn calls
INLINE_SYSCALL macros.

Besides simplify the curent code requirement, it also simplify
possible future ports to require only the C bindings and the direct
assembly one for syscalls.list autogeneration (another possible
work for future would be to use C generate binding to simplify
even further the syscall requirements).

I checked with a build for mostly supported architecture:
aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabhi, i686-linux-gnu,
ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu,
mips{64,64n32}-linux-gnu, nios2-linux-gnu, powerpc{64,64le}-linux-gnu,
s390{x}-linux-gnu, sh4-linux-gnu{-soft}, tile{pro,gx}-linux-gnu{-32},
sparc{v9,64}-linux-gnu, and x86_64-linux-gnu.

I also run a full make check on real hardware on aarch64-linux-gnu,
arm-linux-gnueabihf, i686-linux-gnu, powerpc{64le}-linux-gnu,
sparc{v9,64}-linux-gnu, and x86_64-linux-gnu{-x32}.

Adhemerval Zanella (14):
  Consolidate non cancellable open call
  Consolidate non cancellable read call
  Consolidate non cancellable write call
  Consolidate non cancellable openat call
  Consolidate non cancellable close call
  Consolidate non cancellable writev call
  Consolidate non cancellable fcntl call
  Consolidate non cancellable waitpid call
  Consolidate non cancellable pause call
  Consolidate non cancellable nanosleep call
  Remove non cancellable sigsuspend definition
  Fix {INLINE,INTERNAL}_SYSCALL macros for x32
  Remove p{read,write}{v} and fallocate from x86 auto-generation list
  Remove cancellation support for syscall generation

 ChangeLog                                          | 462 +++++++++++++++++++++
 catgets/open_catalog.c                             |   8 +-
 csu/check_fds.c                                    |   2 +-
 gmon/gmon.c                                        |  22 +-
 iconv/gconv_cache.c                                |   6 +-
 intl/loadmsgcat.c                                  |   6 +-
 io/ftw.c                                           |   8 +-
 libio/fileops.c                                    |  12 +-
 libio/iopopen.c                                    |   4 +-
 locale/loadarchive.c                               |  10 +-
 locale/loadlocale.c                                |  12 +-
 login/utmp_file.c                                  |  30 +-
 misc/daemon.c                                      |   6 +-
 nptl/pthread_mutex_lock.c                          |   2 +-
 nptl/pthread_mutex_timedlock.c                     |   2 +-
 nscd/nscd_getai.c                                  |   2 +-
 nscd/nscd_getgr_r.c                                |   2 +-
 nscd/nscd_gethst_r.c                               |   2 +-
 nscd/nscd_getpw_r.c                                |   2 +-
 nscd/nscd_getserv_r.c                              |   2 +-
 nscd/nscd_helper.c                                 |   4 +-
 nscd/nscd_initgroups.c                             |   2 +-
 nscd/nscd_netgroup.c                               |   4 +-
 nss/nss_db/db-open.c                               |   4 +-
 resolv/herror.c                                    |   2 +-
 resolv/res-close.c                                 |   4 +-
 stdio-common/psiginfo.c                            |   2 +-
 sunrpc/pm_getmaps.c                                |   2 +-
 sysdeps/generic/not-cancel.h                       |  40 +-
 sysdeps/mach/hurd/opendir.c                        |   4 +-
 sysdeps/posix/closedir.c                           |   2 +-
 sysdeps/posix/getaddrinfo.c                        |   4 +-
 sysdeps/posix/getcwd.c                             |   8 +-
 sysdeps/posix/libc_fatal.c                         |   2 +-
 sysdeps/posix/opendir.c                            |  12 +-
 sysdeps/posix/spawni.c                             |  10 +-
 sysdeps/unix/make-syscalls.sh                      |   4 -
 sysdeps/unix/syscall-template.S                    |   7 +-
 sysdeps/unix/sysv/linux/Versions                   |   2 +
 sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h    |  87 +---
 sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h      | 131 +-----
 sysdeps/unix/sysv/linux/arm/sysdep-cancel.h        | 197 +--------
 sysdeps/unix/sysv/linux/check_native.c             |   2 +-
 sysdeps/unix/sysv/linux/check_pf.c                 |   2 +-
 sysdeps/unix/sysv/linux/close.c                    |   8 +
 sysdeps/unix/sysv/linux/fips-private.h             |   6 +-
 sysdeps/unix/sysv/linux/gethostid.c                |  12 +-
 sysdeps/unix/sysv/linux/getloadavg.c               |   6 +-
 sysdeps/unix/sysv/linux/getlogin_r.c               |   6 +-
 sysdeps/unix/sysv/linux/getsysstats.c              |  16 +-
 sysdeps/unix/sysv/linux/grantpt.c                  |   6 +-
 sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h       | 236 +----------
 sysdeps/unix/sysv/linux/i386/smp.h                 |   6 +-
 sysdeps/unix/sysv/linux/i386/sysdep-cancel.h       | 119 +-----
 sysdeps/unix/sysv/linux/ia64/has_cpuclock.c        |   6 +-
 sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h       | 194 +--------
 sysdeps/unix/sysv/linux/if_index.c                 |   6 +-
 sysdeps/unix/sysv/linux/libc_fatal.c               |  10 +-
 sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h       | 108 +----
 sysdeps/unix/sysv/linux/malloc-sysdep.h            |   8 +-
 sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h | 116 +-----
 .../unix/sysv/linux/mips/mips64/sysdep-cancel.h    | 249 -----------
 sysdeps/unix/sysv/linux/mips/sysdep-cancel.h       | 159 +------
 sysdeps/unix/sysv/linux/mq_notify.c                |   2 +-
 sysdeps/unix/sysv/linux/nanosleep.c                |   9 +
 sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h      | 110 +----
 sysdeps/unix/sysv/linux/not-cancel.h               | 118 +++---
 sysdeps/unix/sysv/linux/open.c                     |  18 +
 sysdeps/unix/sysv/linux/open64.c                   |  35 +-
 sysdeps/unix/sysv/linux/openat.c                   |  16 +
 sysdeps/unix/sysv/linux/openat64.c                 |  32 +-
 sysdeps/unix/sysv/linux/pause.c                    |  14 +-
 sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c    |   2 +-
 .../sysv/linux/powerpc/powerpc32/sysdep-cancel.h   | 118 ------
 .../sysv/linux/powerpc/powerpc64/sysdep-cancel.h   | 147 -------
 sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h    |  38 ++
 sysdeps/unix/sysv/linux/pthread_getname.c          |   6 +-
 sysdeps/unix/sysv/linux/pthread_setname.c          |   6 +-
 sysdeps/unix/sysv/linux/read.c                     |   8 +
 .../unix/sysv/linux/s390/s390-32/sysdep-cancel.h   | 105 +----
 .../unix/sysv/linux/s390/s390-64/sysdep-cancel.h   | 109 +----
 sysdeps/unix/sysv/linux/sh/sysdep-cancel.h         | 136 +-----
 .../unix/sysv/linux/sparc/sparc32/sysdep-cancel.h  | 111 -----
 .../unix/sysv/linux/sparc/sparc64/sysdep-cancel.h  | 109 -----
 sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h      |  38 ++
 sysdeps/unix/sysv/linux/spawni.c                   |   8 +-
 sysdeps/unix/sysv/linux/sysconf.c                  |   6 +-
 sysdeps/unix/sysv/linux/tile/sysdep-cancel.h       | 123 +-----
 sysdeps/unix/sysv/linux/waitpid.c                  |  15 +-
 sysdeps/unix/sysv/linux/write.c                    |   8 +
 sysdeps/unix/sysv/linux/x86_64/syscalls.list       |   4 -
 sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h     |  62 +--
 sysdeps/unix/sysv/linux/x86_64/sysdep.h            | 251 ++++++-----
 sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list   |   1 -
 sysdeps/unix/sysv/linux/x86_64/x32/times.c         |  24 +-
 95 files changed, 1129 insertions(+), 3077 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h

-- 
2.7.4

Comments

Adhemerval Zanella Aug. 2, 2017, 2:41 p.m. UTC | #1
With now 2.27 open I would like to push it and remove the syscal-cancel.h
hackery at the start of the window.  I have recently rechecked with a build
on all ports and with exceptions of x86_64 (which this patchset addresses) 
none of Linux ports are currently using any auto-generated cancelable syscall.

On 04/07/2017 16:53, Adhemerval Zanella wrote:
>   - I refactored how internal non cancellable syscalls are implemented

>     within glibc.  On Linux which support cancellation instead of

>     C prepocessor macros, proper function prototypes and implementation

>     are used.  This allows targets that requires specific handling of

>     64 bits arguments, such as x32, to use the correct kernel abi.

> 

> --

> 

> This patchset finishes my previous work of Linux syscall consolidation

> and refactor to finally remove the requeriment of sysdeps-cancel.h

> assembly macros for cancellable syscalls.  All ports now uses the

> SYSCALL_CANCEL macros with C implementation which in turn calls

> INLINE_SYSCALL macros.

> 

> Besides simplify the curent code requirement, it also simplify

> possible future ports to require only the C bindings and the direct

> assembly one for syscalls.list autogeneration (another possible

> work for future would be to use C generate binding to simplify

> even further the syscall requirements).

> 

> I checked with a build for mostly supported architecture:

> aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabhi, i686-linux-gnu,

> ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu,

> mips{64,64n32}-linux-gnu, nios2-linux-gnu, powerpc{64,64le}-linux-gnu,

> s390{x}-linux-gnu, sh4-linux-gnu{-soft}, tile{pro,gx}-linux-gnu{-32},

> sparc{v9,64}-linux-gnu, and x86_64-linux-gnu.

> 

> I also run a full make check on real hardware on aarch64-linux-gnu,

> arm-linux-gnueabihf, i686-linux-gnu, powerpc{64le}-linux-gnu,

> sparc{v9,64}-linux-gnu, and x86_64-linux-gnu{-x32}.

> 

> Adhemerval Zanella (14):

>   Consolidate non cancellable open call

>   Consolidate non cancellable read call

>   Consolidate non cancellable write call

>   Consolidate non cancellable openat call

>   Consolidate non cancellable close call

>   Consolidate non cancellable writev call

>   Consolidate non cancellable fcntl call

>   Consolidate non cancellable waitpid call

>   Consolidate non cancellable pause call

>   Consolidate non cancellable nanosleep call

>   Remove non cancellable sigsuspend definition

>   Fix {INLINE,INTERNAL}_SYSCALL macros for x32

>   Remove p{read,write}{v} and fallocate from x86 auto-generation list

>   Remove cancellation support for syscall generation

> 

>  ChangeLog                                          | 462 +++++++++++++++++++++

>  catgets/open_catalog.c                             |   8 +-

>  csu/check_fds.c                                    |   2 +-

>  gmon/gmon.c                                        |  22 +-

>  iconv/gconv_cache.c                                |   6 +-

>  intl/loadmsgcat.c                                  |   6 +-

>  io/ftw.c                                           |   8 +-

>  libio/fileops.c                                    |  12 +-

>  libio/iopopen.c                                    |   4 +-

>  locale/loadarchive.c                               |  10 +-

>  locale/loadlocale.c                                |  12 +-

>  login/utmp_file.c                                  |  30 +-

>  misc/daemon.c                                      |   6 +-

>  nptl/pthread_mutex_lock.c                          |   2 +-

>  nptl/pthread_mutex_timedlock.c                     |   2 +-

>  nscd/nscd_getai.c                                  |   2 +-

>  nscd/nscd_getgr_r.c                                |   2 +-

>  nscd/nscd_gethst_r.c                               |   2 +-

>  nscd/nscd_getpw_r.c                                |   2 +-

>  nscd/nscd_getserv_r.c                              |   2 +-

>  nscd/nscd_helper.c                                 |   4 +-

>  nscd/nscd_initgroups.c                             |   2 +-

>  nscd/nscd_netgroup.c                               |   4 +-

>  nss/nss_db/db-open.c                               |   4 +-

>  resolv/herror.c                                    |   2 +-

>  resolv/res-close.c                                 |   4 +-

>  stdio-common/psiginfo.c                            |   2 +-

>  sunrpc/pm_getmaps.c                                |   2 +-

>  sysdeps/generic/not-cancel.h                       |  40 +-

>  sysdeps/mach/hurd/opendir.c                        |   4 +-

>  sysdeps/posix/closedir.c                           |   2 +-

>  sysdeps/posix/getaddrinfo.c                        |   4 +-

>  sysdeps/posix/getcwd.c                             |   8 +-

>  sysdeps/posix/libc_fatal.c                         |   2 +-

>  sysdeps/posix/opendir.c                            |  12 +-

>  sysdeps/posix/spawni.c                             |  10 +-

>  sysdeps/unix/make-syscalls.sh                      |   4 -

>  sysdeps/unix/syscall-template.S                    |   7 +-

>  sysdeps/unix/sysv/linux/Versions                   |   2 +

>  sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h    |  87 +---

>  sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h      | 131 +-----

>  sysdeps/unix/sysv/linux/arm/sysdep-cancel.h        | 197 +--------

>  sysdeps/unix/sysv/linux/check_native.c             |   2 +-

>  sysdeps/unix/sysv/linux/check_pf.c                 |   2 +-

>  sysdeps/unix/sysv/linux/close.c                    |   8 +

>  sysdeps/unix/sysv/linux/fips-private.h             |   6 +-

>  sysdeps/unix/sysv/linux/gethostid.c                |  12 +-

>  sysdeps/unix/sysv/linux/getloadavg.c               |   6 +-

>  sysdeps/unix/sysv/linux/getlogin_r.c               |   6 +-

>  sysdeps/unix/sysv/linux/getsysstats.c              |  16 +-

>  sysdeps/unix/sysv/linux/grantpt.c                  |   6 +-

>  sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h       | 236 +----------

>  sysdeps/unix/sysv/linux/i386/smp.h                 |   6 +-

>  sysdeps/unix/sysv/linux/i386/sysdep-cancel.h       | 119 +-----

>  sysdeps/unix/sysv/linux/ia64/has_cpuclock.c        |   6 +-

>  sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h       | 194 +--------

>  sysdeps/unix/sysv/linux/if_index.c                 |   6 +-

>  sysdeps/unix/sysv/linux/libc_fatal.c               |  10 +-

>  sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h       | 108 +----

>  sysdeps/unix/sysv/linux/malloc-sysdep.h            |   8 +-

>  sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h | 116 +-----

>  .../unix/sysv/linux/mips/mips64/sysdep-cancel.h    | 249 -----------

>  sysdeps/unix/sysv/linux/mips/sysdep-cancel.h       | 159 +------

>  sysdeps/unix/sysv/linux/mq_notify.c                |   2 +-

>  sysdeps/unix/sysv/linux/nanosleep.c                |   9 +

>  sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h      | 110 +----

>  sysdeps/unix/sysv/linux/not-cancel.h               | 118 +++---

>  sysdeps/unix/sysv/linux/open.c                     |  18 +

>  sysdeps/unix/sysv/linux/open64.c                   |  35 +-

>  sysdeps/unix/sysv/linux/openat.c                   |  16 +

>  sysdeps/unix/sysv/linux/openat64.c                 |  32 +-

>  sysdeps/unix/sysv/linux/pause.c                    |  14 +-

>  sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c    |   2 +-

>  .../sysv/linux/powerpc/powerpc32/sysdep-cancel.h   | 118 ------

>  .../sysv/linux/powerpc/powerpc64/sysdep-cancel.h   | 147 -------

>  sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h    |  38 ++

>  sysdeps/unix/sysv/linux/pthread_getname.c          |   6 +-

>  sysdeps/unix/sysv/linux/pthread_setname.c          |   6 +-

>  sysdeps/unix/sysv/linux/read.c                     |   8 +

>  .../unix/sysv/linux/s390/s390-32/sysdep-cancel.h   | 105 +----

>  .../unix/sysv/linux/s390/s390-64/sysdep-cancel.h   | 109 +----

>  sysdeps/unix/sysv/linux/sh/sysdep-cancel.h         | 136 +-----

>  .../unix/sysv/linux/sparc/sparc32/sysdep-cancel.h  | 111 -----

>  .../unix/sysv/linux/sparc/sparc64/sysdep-cancel.h  | 109 -----

>  sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h      |  38 ++

>  sysdeps/unix/sysv/linux/spawni.c                   |   8 +-

>  sysdeps/unix/sysv/linux/sysconf.c                  |   6 +-

>  sysdeps/unix/sysv/linux/tile/sysdep-cancel.h       | 123 +-----

>  sysdeps/unix/sysv/linux/waitpid.c                  |  15 +-

>  sysdeps/unix/sysv/linux/write.c                    |   8 +

>  sysdeps/unix/sysv/linux/x86_64/syscalls.list       |   4 -

>  sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h     |  62 +--

>  sysdeps/unix/sysv/linux/x86_64/sysdep.h            | 251 ++++++-----

>  sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list   |   1 -

>  sysdeps/unix/sysv/linux/x86_64/x32/times.c         |  24 +-

>  95 files changed, 1129 insertions(+), 3077 deletions(-)

>  delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h

>  delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h

>  delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h

>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h

>  delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h

>  delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h

>  create mode 100644 sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h

>