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 DF331385843E for ; Wed, 18 Jan 2023 22:29:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF331385843E 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=1674080987; 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=nkncnKaFR2fKVsfUpxWfbRWuFBud5ZWpiB/UEzzX4T4=; b=J19ipv5ba6SDjTY9wQJv/QjzSWdSlKDFxlkvxfGEpA0HSzNwhREC08JzZj2M7q76AordGd m1JO+EGJV5YvucPuEi8YadXOUCg7orEJh4rUW7pKrF2gtMYz3KlS38/Pj+T7qCQ9MbUBkh hGfeLpPVGG5taQE81TLLmN/wpAaU0dE= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-620-_xNjVa3mNHS4e-iEGyV6gg-1; Wed, 18 Jan 2023 17:29:46 -0500 X-MC-Unique: _xNjVa3mNHS4e-iEGyV6gg-1 Received: by mail-il1-f197.google.com with SMTP id l14-20020a056e02066e00b0030bff7a1841so328705ilt.23 for ; Wed, 18 Jan 2023 14:29: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=nkncnKaFR2fKVsfUpxWfbRWuFBud5ZWpiB/UEzzX4T4=; b=XTB616ApyQG9uf3mG6FNSPzRN0agGOsuu6xFBeCQdstHncbYVsmT6A++/3zHBSsj7l 4rmg9UlbrVEl3OgQ/hzGQkgCL1pFoY/GzqmM8ZNfvbrVOgTTtqHDt0M31APlCo8Mt3/9 DmVbdCgw2s4TTYGsHv5942M1wWDtFtb1gRlY/azOt1zZXejJ/97o93DCOQ2Pk3VXM2j9 L0ZQeDyN9tcVsU8OpRhB9NRWeo0waP5MDz5uyF70uEruda+Wlj5L/WDFxAnHVuQtQGV7 YySUfBbflRAllslnvDk0MpTaN08RBHkDjhNGsj2/ep7I1Q6yBgrONTIXM506p+E9HdHm O7dg== X-Gm-Message-State: AFqh2kqmZApwPZ8yaNJjB/+ZP0zk/FyMPYwnCAsK0U9ZSlN4+8QPdg9R rAAPhLIxG9/hCBf+4hd/SJJjz9DcgZKovsDsAbECNdWnuj6BXnYjEkjM2ICUygpQc+wXizfuia0 DQs/k41e0YK2U2Zg1avrT X-Received: by 2002:a05:6e02:1d02:b0:30d:b3c3:f94c with SMTP id i2-20020a056e021d0200b0030db3c3f94cmr8282335ila.2.1674080984622; Wed, 18 Jan 2023 14:29:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXuSBWMn28Tuuy5sD6svLgOQ7uYD17NX9u7uWJphdrxJU4Rqi0xqw2o/vmnkwSLTAclnofE2hA== X-Received: by 2002:a05:6e02:1d02:b0:30d:b3c3:f94c with SMTP id i2-20020a056e021d0200b0030db3c3f94cmr8282322ila.2.1674080984395; Wed, 18 Jan 2023 14:29:44 -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 y1-20020a92c981000000b0030392271239sm10268397iln.8.2023.01.18.14.29.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 14:29:43 -0800 (PST) Message-ID: <3e82c148-0a27-8266-4821-e455f16a0f16@redhat.com> Date: Wed, 18 Jan 2023 17:29:42 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v4 5/6] aarch64: Add the clone3 wrapper To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20230112135853.3786675-1-adhemerval.zanella@linaro.org> <20230112135853.3786675-6-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <20230112135853.3786675-6-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=-12.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 1/12/23 08:58, Adhemerval Zanella wrote: > It follow the internal signature: > > extern int clone3 (struct clone_args *__cl_args, size_t __size, > int (*__func) (void *__arg), void *__arg); > > Checked on aarch64-linux-gnu. OK for 2.28. Reviewed-by: Carlos O'Donell > --- > sysdeps/unix/sysv/linux/aarch64/clone3.S | 85 ++++++++++++++++++++++++ > sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 + > 2 files changed, 87 insertions(+) > create mode 100644 sysdeps/unix/sysv/linux/aarch64/clone3.S > > diff --git a/sysdeps/unix/sysv/linux/aarch64/clone3.S b/sysdeps/unix/sysv/linux/aarch64/clone3.S > new file mode 100644 > index 0000000000..88a1fa1e89 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/aarch64/clone3.S > @@ -0,0 +1,85 @@ > +/* The clone3 syscall wrapper. Linux/aarch64 version. > + Copyright (C) 2023 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 > + . */ > + > +#include > +#define _ERRNO_H 1 > +#include > + > +/* The userland implementation is: > + int clone3 (struct clone_args *cl_args, size_t size, > + int (*func)(void *arg), void *arg); > + > + the kernel entry is: > + int clone3 (struct clone_args *cl_args, size_t size); > + > + The parameters are passed in registers from userland: > + x0: cl_args > + x1: size > + x2: func > + x3: arg */ > + > + .text > +ENTRY(__clone3) > + PTR_ARG (0) > + PTR_ARG (1) > + PTR_ARG (3) > + PTR_ARG (4) > + /* Save args for the child. */ > + mov x10, x0 /* cl_args */ > + mov x11, x2 /* func */ > + mov x12, x3 /* args */ > + > + /* Sanity check args. */ > + mov x0, #-EINVAL > + cbz x10, .Lsyscall_error /* No NULL cl_args pointer. */ > + cbz x2, .Lsyscall_error /* No NULL function pointer. */ > + > + /* Do the system call, the kernel expects: > + x8: system call number > + x0: cl_args > + x1: size */ > + mov x0, x10 > + mov x8, #SYS_ify(clone3) > + svc 0x0 > + > + cmp x0, #0 > + beq thread_start > + blt .Lsyscall_error > + RET > +PSEUDO_END (__clone3) > + > + .align 4 > + .type thread_start, %function > +thread_start: > + cfi_startproc > + cfi_undefined (x30) > + mov x29, 0 > + > + /* Pick the function arg and execute. */ > + mov x0, x12 > + blr x11 > + > + /* We are done, pass the return value through x0. */ > + mov x8, #SYS_ify(exit) > + svc 0x0 > + cfi_endproc > + .size thread_start, .-thread_start OK. > + > +libc_hidden_def (__clone3) > +weak_alias (__clone3, clone3) > diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h > index 6520fa15da..e94d1703ad 100644 > --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h > +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h > @@ -165,6 +165,8 @@ > # define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" > # define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" > > +# define HAVE_CLONE3_WRAPPER 1 OK. Enables the optimizations where possible. > + > # undef INTERNAL_SYSCALL_RAW > # define INTERNAL_SYSCALL_RAW(name, nr, args...) \ > ({ long _sys_result; \ -- Cheers, Carlos.