public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/11] Optimize posix_spawn signal setup with clone3
@ 2022-11-04 19:01 Adhemerval Zanella
  2022-11-04 19:01 ` [PATCH v2 01/11] linux: Do not reset signal handler in posix_spawn if it is already SIG_DFL Adhemerval Zanella
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Adhemerval Zanella @ 2022-11-04 19:01 UTC (permalink / raw)
  To: libc-alpha, Szabolcs Nagy, H . J . Lu; +Cc: Christian Brauner

Currently posix_spawn has to issue at least NSIG sigaction syscalls
to obtain current signal disposition and more if they there are not
either SIG_IGN or SIG_DFL.  The new clone3 CLONE_CLEAR_SIGHAND flags
introduced with Linux 5.5 resets all signal handlers of the child not
set to SIG_IGN to SIG_DFL, thus allowing posix_spawn to skip this
preparation phase.

The exception is the signals defined by posix_spawnattr_setsigdefault
when POSIX_SPAWN_SETSIGDEF is set (since they can be SIG_IGN).  In
this case posix_spawn helper process needs to issue a sigction to 
set the signal disposition to SIG_DFL.

The patchset also adds clone3 implementation for aarch64, powerpc64,
s390x, riscv, arm, and mips.  The clone3 for x86_64 is change to not
align the stack, since this is not async-signal safe (although current
calls does mask/unmask).

* Changes from v1:
- Extend clone3 documentation.
- Remove x86_64 stack alignment on clone3 child.
- Fixed powerpc64 missing initial stack frame.
- Fixed missing save/restore r7 for arm.

Adhemerval Zanella (11):
  linux: Do not reset signal handler in posix_spawn if it is already
    SIG_DFL
  linux: Extend internal clone3 documentation
  Linux: Do not align the stack for __clone3
  linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn
  powerpc64: Add the clone3 wrapper
  aarch64: Add the clone3 wrapper
  s390x: Add the clone3 wrapper
  riscv: Add the clone3 wrapper
  arm: Add the clone3 wrapper
  mips: Add the clone3 wrapper
  Linux: optimize clone3 internal usage

 include/clone_internal.h                      |  39 +++-
 posix/Makefile                                |   3 +-
 posix/tst-spawn7.c                            | 179 ++++++++++++++++++
 sysdeps/unix/sysv/linux/Makefile              |   3 +-
 sysdeps/unix/sysv/linux/aarch64/clone3.S      |  85 +++++++++
 sysdeps/unix/sysv/linux/aarch64/sysdep.h      |   2 +
 sysdeps/unix/sysv/linux/arm/clone3.S          |  80 ++++++++
 sysdeps/unix/sysv/linux/arm/sysdep.h          |   1 +
 sysdeps/unix/sysv/linux/clone-internal.c      |  59 ++++--
 sysdeps/unix/sysv/linux/clone3.h              |  15 +-
 sysdeps/unix/sysv/linux/kernel-features.h     |   9 +
 sysdeps/unix/sysv/linux/mips/clone3.S         | 139 ++++++++++++++
 sysdeps/unix/sysv/linux/mips/sysdep.h         |   2 +
 .../sysv/linux/powerpc/powerpc64/clone3.S     | 152 +++++++++++++++
 sysdeps/unix/sysv/linux/powerpc/sysdep.h      |   1 +
 sysdeps/unix/sysv/linux/riscv/clone3.S        |  80 ++++++++
 sysdeps/unix/sysv/linux/riscv/sysdep.h        |   1 +
 sysdeps/unix/sysv/linux/s390/s390-64/clone3.S |  81 ++++++++
 sysdeps/unix/sysv/linux/s390/sysdep.h         |   1 +
 sysdeps/unix/sysv/linux/spawni.c              |  33 +++-
 .../sysv/linux/tst-misalign-clone-internal.c  |  74 --------
 sysdeps/unix/sysv/linux/x86_64/clone3.S       |   3 -
 22 files changed, 924 insertions(+), 118 deletions(-)
 create mode 100644 posix/tst-spawn7.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S
 create mode 100644 sysdeps/unix/sysv/linux/arm/clone3.S
 create mode 100644 sysdeps/unix/sysv/linux/mips/clone3.S
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/clone3.S
 create mode 100644 sysdeps/unix/sysv/linux/riscv/clone3.S
 create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/clone3.S
 delete mode 100644 sysdeps/unix/sysv/linux/tst-misalign-clone-internal.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2023-01-11 21:45 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 19:01 [PATCH v2 00/11] Optimize posix_spawn signal setup with clone3 Adhemerval Zanella
2022-11-04 19:01 ` [PATCH v2 01/11] linux: Do not reset signal handler in posix_spawn if it is already SIG_DFL Adhemerval Zanella
2023-01-11 21:27   ` Carlos O'Donell
2022-11-04 19:01 ` [PATCH v2 02/11] linux: Extend internal clone3 documentation Adhemerval Zanella
2022-11-07 16:40   ` Szabolcs Nagy
2023-01-11 21:35   ` Carlos O'Donell
2022-11-04 19:01 ` [PATCH v2 03/11] Linux: Do not align the stack for __clone3 Adhemerval Zanella
2023-01-11 21:43   ` Carlos O'Donell
2022-11-04 19:01 ` [PATCH v2 04/11] linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn Adhemerval Zanella
2023-01-11 21:44   ` Carlos O'Donell
2022-11-04 19:01 ` [PATCH v2 05/11] powerpc64: Add the clone3 wrapper Adhemerval Zanella
2022-11-28 16:38   ` Paul E Murphy
2022-11-29 20:43     ` Adhemerval Zanella Netto
2022-11-04 19:01 ` [PATCH v2 06/11] aarch64: " Adhemerval Zanella
2022-11-07 16:14   ` Szabolcs Nagy
2022-11-04 19:01 ` [PATCH v2 07/11] s390x: " Adhemerval Zanella
2022-11-04 19:01 ` [PATCH v2 08/11] riscv: " Adhemerval Zanella
2022-11-04 19:01 ` [PATCH v2 09/11] arm: " Adhemerval Zanella
2022-11-04 19:01 ` [PATCH v2 10/11] mips: " Adhemerval Zanella
2022-11-04 19:01 ` [PATCH v2 11/11] Linux: optimize clone3 internal usage Adhemerval Zanella
2023-01-11 21:45   ` Carlos O'Donell
2023-01-11 21:24 ` [PATCH v2 00/11] Optimize posix_spawn signal setup with clone3 Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).