From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 374FC3858C83 for ; Wed, 11 Jan 2023 21:15:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 374FC3858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673471745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NZwlGCO2H+x53PdjygQkmIC7WdILW9aIBGOOTPVP2WA=; b=O7+7qhOx33ZoVu98uaGvsCFRRqc1+TR3T6WBwTpPSQt1KOYnyyEo+JbYBdQccXbxMuR+Un 6G4SWUxC09GnryraSQCAH5kS2zCwXxrYjJGD5I/YgZRfCqRfZPa/NlJCHbUKWB46ir6jYR n8PKjn6ubnkgtum5irck/ULNwjYARgk= Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-208-fJVm0hi8N4u8OdBQzNeaZw-1; Wed, 11 Jan 2023 16:11:45 -0500 X-MC-Unique: fJVm0hi8N4u8OdBQzNeaZw-1 Received: by mail-il1-f200.google.com with SMTP id r6-20020a92cd86000000b00304b2d1c2d7so11821686ilb.11 for ; Wed, 11 Jan 2023 13:11:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NZwlGCO2H+x53PdjygQkmIC7WdILW9aIBGOOTPVP2WA=; b=EYbpKi8b5KraZQWDwsgAslHqyn+WYV7pU7p0OyLUwIioEwlgi6xVgwPPo7u/eiRJDc hIeP4HS7CnAjZBd9AGKW+M9nMnOKWPccOnbTEdUmuCk83bKtsEGNY6HDUD9KT43Vpn+e wbwPyvxigp90chjaRJdzLYQLMlFbQTkIMTNJ1wjupPQI+TRAz6lEFU/aMie2MjBzrvG2 XCh9B7vxPJoE7x7asnypHA16xk1QeA+tcGPTcn3glCEEm3i0IFicMyR23fMe8q0St47L Clye2N0TMZtzOnih4BpPe2i2NrSM77XsLCMyGz/lB6fAVgnNIHHYsbJ1SfjY2WrpIB28 7S4A== X-Gm-Message-State: AFqh2koTkgKzTNU6P9hJMd/9bOFvQ2sHL9XuQaiFXiRB3NHOYSe4CS7H DiuA1RERqGAVRSdqgStLLjfc6Mnyxfr9GK/SlJSKH/JJ6G6+/DyYu0zHnqS6Fft+255hptQxQyG 5yWXjRkvCUy5o6LlpwcQS X-Received: by 2002:a6b:d117:0:b0:6e3:1588:83d9 with SMTP id l23-20020a6bd117000000b006e3158883d9mr49959227iob.0.1673471504194; Wed, 11 Jan 2023 13:11:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXvpBLfJhZ1X5YpazJTPVbw0TQuljruxs7GqEeIsDdOLCTXbHTUklHlHXOTxBFBPIRycORF7WA== X-Received: by 2002:a6b:d117:0:b0:6e3:1588:83d9 with SMTP id l23-20020a6bd117000000b006e3158883d9mr49959219iob.0.1673471503938; Wed, 11 Jan 2023 13:11:43 -0800 (PST) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id k32-20020a026620000000b003755a721e98sm4841481jac.107.2023.01.11.13.11.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Jan 2023 13:11:43 -0800 (PST) Message-ID: <43023ffd-bdd9-e431-88ce-2f41740c4287@redhat.com> Date: Wed, 11 Jan 2023 16:11:42 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH v2 0/9] Optimize posix_spawn signal setup with clone3 To: Adhemerval Zanella , libc-alpha@sourceware.org, Christian Brauner References: <20220930192613.3491147-1-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <20220930192613.3491147-1-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: On 9/30/22 15:26, Adhemerval Zanella via Libc-alpha wrote: > 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. > I would like to trim this down for glibc 2.37. I think we can get the default implementation in place and enable this for x86_64. Everything else that adds custom assembly should be something we commit once 2.38 opens and so we can have time to review the generated code and make sure we don't break anything. I'd like to see a v3 posted with just the 3 patches required to turn this on: 1/9 linux: Do not reset signal handler in posix_spawn if it is already SIG_DFL 2/9 linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn 9/9 Linux: optimize clone3 internal usage > 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 > -- Cheers, Carlos.