From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by sourceware.org (Postfix) with ESMTPS id A867D3858D1E for ; Fri, 30 Sep 2022 19:26:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A867D3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ua1-x931.google.com with SMTP id e22so2100008uar.5 for ; Fri, 30 Sep 2022 12:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date; bh=ryfALtU2CfVPcHISjV7lei4Az8RmO1lvJXX2fgiqNYc=; b=pofWVmqkCucYx5pJTwPbJ3jN4gih00gcWAeuGKnuYw8vqZg4dkUrldbyyMnlWfJNQQ jL+GqT7+su3SUtMML5NSzgITFPDcLhydy+NnwIYCtX9iltLq5ul4NtuYaCfxh903+ABQ o4mtOi6WAaIQc3dQ9wpLqVSTh3lz6b0EcLZ7WBgPO3Ho8kRyFP9oyqV2sa+VzXJDYhHk AkipvZSFxfeNn8JqX3BWe6C+EaR6RXKSTBNC1o0xemc7ldaAvp0ox3W8MOhrv0SM80zt E+E4ox7XetKmyML9N+YtsuUuM+87n5Q2zoJvByP5kysiUS95457u3V5GJSlS5TNJY0iM Ue3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=ryfALtU2CfVPcHISjV7lei4Az8RmO1lvJXX2fgiqNYc=; b=ez87BBaXCw4NApB6slk/mQb6ms9T1fqG8LFDRc+8pu8maHlYBhZ2Wd/KCb9Ok4RpMH wbRAl6VeAN2wtEHquy2KxhowFLYrj/Wtq9IBR0Mk/PS0J0vbe01/02Mk3LqDQ0KY/HXA t617+dMRUPif3V+q2SDxPrbMPxH7x1d02XGEfaklIaHPCGKHSg3Hfa+c5Akn+bLMiHkE 5z+sRCj1onuDgUD2XY4HCtaobgwFuDmwCElc3mwH6cArzC/zuHgpidbl94I8T9oUYlM/ pWJ+jb3itggPLHbk6EBh5ic1mYtq8FsFXNWq0SJDz/2Kxr2KaSY4/0xe+8BnM+vbN+Sy YmyQ== X-Gm-Message-State: ACrzQf2PjgmhNJdeBcaPGeZy66E+fR2cyi4pO67/8r0n9Da6HFGzUMxj lhuKafdRLOSfB87RyfpEOXHJ3LGArNAxXOK1 X-Google-Smtp-Source: AMsMyM70HADuTnnnyvjUXUUCF2+O+KM3JlCHDKiJWdiXEKCj25DiDklBqMHEzV9sclCb8wJskQ7wEQ== X-Received: by 2002:a05:6130:291:b0:3be:ec87:9f84 with SMTP id q17-20020a056130029100b003beec879f84mr5875024uac.88.1664565977808; Fri, 30 Sep 2022 12:26:17 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:3736:cce5:8b83:d63b:2954]) by smtp.gmail.com with ESMTPSA id h197-20020a1f21ce000000b0039ecbaa55d8sm2381545vkh.44.2022.09.30.12.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 12:26:17 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Christian Brauner Subject: [PATCH v2 0/9] Optimize posix_spawn signal setup with clone3 Date: Fri, 30 Sep 2022 16:26:04 -0300 Message-Id: <20220930192613.3491147-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. Changes from v1: * Adeed arm and mips clone3 implementation. Adhemerval Zanella (9): linux: Do not reset signal handler in posix_spawn if it is already SIG_DFL linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn powerpc64le: 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 | 10 + posix/Makefile | 3 +- posix/tst-spawn7.c | 179 ++++++++++++++++++ sysdeps/unix/sysv/linux/aarch64/clone3.S | 90 +++++++++ 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 | 6 + sysdeps/unix/sysv/linux/kernel-features.h | 9 + sysdeps/unix/sysv/linux/mips/clone3.S | 147 ++++++++++++++ sysdeps/unix/sysv/linux/mips/sysdep.h | 2 + .../sysv/linux/powerpc/powerpc64/clone3.S | 145 ++++++++++++++ sysdeps/unix/sysv/linux/powerpc/sysdep.h | 1 + sysdeps/unix/sysv/linux/riscv/clone3.S | 83 ++++++++ sysdeps/unix/sysv/linux/riscv/sysdep.h | 1 + sysdeps/unix/sysv/linux/s390/s390-64/clone3.S | 84 ++++++++ sysdeps/unix/sysv/linux/s390/sysdep.h | 1 + sysdeps/unix/sysv/linux/spawni.c | 33 +++- 19 files changed, 910 insertions(+), 26 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 -- 2.34.1