From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id B1849385B51B for ; Tue, 7 Mar 2023 12:03:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B1849385B51B 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-oi1-x236.google.com with SMTP id e21so9413542oie.1 for ; Tue, 07 Mar 2023 04:03:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678190596; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=A3bzN9xyTF1UYWyBo0gCqntIyceSZwlQ/Xh92SOpM08=; b=cGH183OqhuFt5Wgsgtp5RAeQSQbOmbWowV8hnQAsHRRdq0Q8WOqVDrYdySxvmcoclk Clej9S5XFM3QNJ8coN/F7gDw72HkWssNqA11HY1zOf0vcjb7WW+4DBz06VYi+6hgvBVR EOsHq9kD616NlfKqgX9TUfWnMeHZ9Sm+p6BWfv6+Y0pQxi++5UmWIo/H67ZK0er8RLXV Pyo2OqzlTWr/nmbhrNSfrvloVPBgBrz+lJSRTGQPH46vILQQUua+EWEyI+xeoSXtmg9o Bf5BCv80a+99JVYZ0JqK/0IhOxGU7/BnKLmRGgHPvJM9bG4/FFuE0AxamyoIBw41aAPE Br4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678190596; h=content-transfer-encoding:in-reply-to:organization:from:references :cc: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=A3bzN9xyTF1UYWyBo0gCqntIyceSZwlQ/Xh92SOpM08=; b=1Y2zdHlHUDozcsMv8OE4nHCv46/XYTNUKv5kGvUO4cWEnbHWg4wDSqS4//ava2eXlt /nmbEuuN6f5X+8gGWpyLsXoO3qV3fMPLw4avkXpkZMfFqX4wJpLBtJoutfLoh/IW7v3G 520XjxOUPzGyhg5NUfqWzGZSxHYJWjY80XhUAUOL/WikqADR59PkYzcUt3orz/wY1lVk SyZXLFNgHR2cHzKBm83uJjuiBjA8+1MyzccL/ZZg6bZSZ8l6tgmY1MHW+yxJpDPwVXiH 3MInEJeVy327IfLv4PnPC25HyPR1A8bNerisyRBmtPe2rl3d9KCv1l+k+8eSVIt2phHo oq5w== X-Gm-Message-State: AO0yUKX7D+ylqleHevd3ddEmECme0/MBO+zigJbC6E/oBvRS9NQlJTlr fkn7BcjXaGzDanXOkqgh8+H6kg== X-Google-Smtp-Source: AK7set/8dZkF9X9bBui0a8/YDhasroE69GrT9hdaOkh0X5/JtAkYuEr+RTaTiSpqQUx29C7Wgt4qeA== X-Received: by 2002:a54:4684:0:b0:384:3473:66ad with SMTP id k4-20020a544684000000b00384347366admr5857679oic.39.1678190594589; Tue, 07 Mar 2023 04:03:14 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c3:d849:85a1:d2e8:5a25:72e7? ([2804:1b3:a7c3:d849:85a1:d2e8:5a25:72e7]) by smtp.gmail.com with ESMTPSA id r8-20020a0568080aa800b00383cc29d6b2sm4976238oij.51.2023.03.07.04.03.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Mar 2023 04:03:13 -0800 (PST) Message-ID: <54b35884-f250-e212-38eb-b0604f496246@linaro.org> Date: Tue, 7 Mar 2023 09:03:11 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 2/2] ARC: run child from the separate start block in __clone Content-Language: en-US To: Pavel.Kozlov@synopsys.com, libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org References: <20230302161019.27192-1-kozlov@synopsys.com> <20230302161019.27192-2-kozlov@synopsys.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20230302161019.27192-2-kozlov@synopsys.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 02/03/23 13:10, Pavel Kozlov via Libc-alpha wrote: > From: Pavel Kozlov > > For better debug experience use separate code block with extra > cfi_* directives to run child (same as in __clone3). LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > sysdeps/unix/sysv/linux/arc/clone.S | 40 ++++++++++++++++++----------- > 1 file changed, 25 insertions(+), 15 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/arc/clone.S b/sysdeps/unix/sysv/linux/arc/clone.S > index 766649625658..0029aaeb8170 100644 > --- a/sysdeps/unix/sysv/linux/arc/clone.S > +++ b/sysdeps/unix/sysv/linux/arc/clone.S > @@ -20,9 +20,6 @@ > #include > #define _ERRNO_H 1 > #include > -#include > - > -#define CLONE_SETTLS 0x00080000 > > /* int clone(int (*fn)(void *), void *child_stack, > int flags, void *arg, ... > @@ -63,19 +60,9 @@ ENTRY (__clone) > ARC_TRAP_INSN > > cmp r0, 0 /* return code : 0 new process, !0 parent. */ > + beq thread_start_clone > blt L (__sys_err2) /* < 0 (signed) error. */ > - jnz [blink] /* Parent returns. */ > - > - /* child jumps off to @fn with @arg as argument > - TP register already set by kernel. */ > - jl.d [r10] > - mov r0, r11 > - > - /* exit() with result from @fn (already in r0). */ > - mov r8, __NR_exit > - ARC_TRAP_INSN > - /* In case it ever came back. */ > - flag 1 > + j [blink] /* Parent returns. */ > > L (__sys_err): > mov r0, -EINVAL > @@ -89,5 +76,28 @@ L (__sys_err2): > position independent. */ > b __syscall_error > PSEUDO_END (__clone) > + > + > + .align 4 > + .type thread_start_clone, %function > +thread_start_clone: > + cfi_startproc > + /* Terminate call stack by noting ra is undefined. */ > + cfi_undefined (blink) > + > + /* Child jumps off to @fn with @arg as argument. */ > + jl.d [r10] > + mov r0, r11 > + > + /* exit() with result from @fn (already in r0). */ > + mov r8, __NR_exit > + ARC_TRAP_INSN > + > + /* In case it ever came back. */ > + flag 1 > + > + cfi_endproc > + .size thread_start_clone, .-thread_start_clone > + > libc_hidden_def (__clone) > weak_alias (__clone, clone)