Message ID | 20230802051924.7837-1-rdunlap@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp232275vqx; Tue, 1 Aug 2023 22:56:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlElUkVzs4lZnGfhoyyZHok2Nu7BfTqas8o7QhrDCm/3Vsp0N5m6vn3fI3iRQ33TwfeImThQ X-Received: by 2002:a05:6358:7e9a:b0:12f:22c1:66aa with SMTP id o26-20020a0563587e9a00b0012f22c166aamr5030303rwn.3.1690955789162; Tue, 01 Aug 2023 22:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690955789; cv=none; d=google.com; s=arc-20160816; b=RI4bBFTHQcGNbkhWWk94eByvr96qM/r8Y1+XeXLPyaj8UAvSIgK0WzrBWVYv5qPGeq 0juXF0mZLg1Av80u6ITknEmPoCi+WkXoRJe8Bi5mRx3YUheCeklvh9vuUstno+FvCQYC FRXwkS0nMYBkhIJgulrmiTwfTzrhHV2gHN+om3HAxE9QjX98YM1PRbRyndzwrHYOMdX5 UWiWw3IVcH3DU04ujzqAXfpu4oLuiQ9pkiJw0pFffToMXboX3sVH8vYIVtgn8Y9QYjZI 5EYnelrH7GAi2fHluCHrWaJ5tv/nMGFupjo2iEPQ2eFASZUCBhDqo85CyrruaFPWBey3 VDZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/0CU48Zw70eP8gCcZfPtoIrEyWctIOGQrz7h9ITawzM=; fh=1lUEDpU4Gjp3xXIpz0s8RIOyv8b/0Ai3wMPV0+4g9ks=; b=00OYhxW1G+RJzY/xfqIj1gPs9YdYAh/AXZdqAK0WQyq9tZBLZbAqH/drSpootqwey6 PRT88djB9J5Erg+OdxTpjDLOcqbQOGi4r+qK6ZjgQM41qlwIiTUmcQiuQU+TXryiqwON 3MdfyZML7omb18dyowiNPl12+yV7Lc+DaV8om/j5AHeKro4cHt9Mg6PxiEJlFJ8kzu65 WTFe72yhttkLu55EDCFjlWSPUWmKwg8gegWiU2mQGH5EZXSDOIHwn5BSlLd+k1+6SCJa tBAXUQmoYQccGtmf47fQ8gHvm3yZ8F1M+1jtVffUw+vMoSsJGeqiiQSCXQdS50YDeIOE yU/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BjWKxpZG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a630015000000b005538961c4ebsi10147897pga.715.2023.08.01.22.56.16; Tue, 01 Aug 2023 22:56:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BjWKxpZG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232381AbjHBFUS (ORCPT <rfc822;maxi.paulin@gmail.com> + 99 others); Wed, 2 Aug 2023 01:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232412AbjHBFTq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Aug 2023 01:19:46 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96CCA210D for <linux-kernel@vger.kernel.org>; Tue, 1 Aug 2023 22:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=/0CU48Zw70eP8gCcZfPtoIrEyWctIOGQrz7h9ITawzM=; b=BjWKxpZG+8KfojucOLyUNYAbPV r84HoLLtxHBma5a0aWgIcRFjRNK14l2Gc8kotnZxbLuxpfNxOjvtW6xsfqrhzQbRXpRPm4Yd652Ft bjnE4WB/9sX2mPzHNTm6+vkqOVZDaC1FoSdNshu/MWLA65YnHBguCmoSGay2n+5cYIoOjPl+Nyyfc fETQHCV6cgvsqJFXdsn+zhCUfQLni74w37zWDSnDoUUBhuy/O32OgtXe7KKR+MvGzDRQqtKGUC2Rb lYQi1Oock4Fy10eaudKkN5ZH3YNSVLTzFw7yiz/+tLhsxz0+a0fafMYdqRsnyYBy8SovyY4Wq0tPR MP9pjzpQ==; Received: from [2601:1c2:980:9ec0::2764] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qR4Ga-0042og-39; Wed, 02 Aug 2023 05:19:25 +0000 From: Randy Dunlap <rdunlap@infradead.org> To: linux-kernel@vger.kernel.org Cc: Randy Dunlap <rdunlap@infradead.org>, Dinh Nguyen <dinguyen@kernel.org>, Christian Brauner <christian@brauner.io> Subject: [PATCH RESEND^2] nios2: support clone3() syscall Date: Tue, 1 Aug 2023 22:19:24 -0700 Message-ID: <20230802051924.7837-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773095657459735259 X-GMAIL-MSGID: 1773095657459735259 |
Series |
[RESEND^2] nios2: support clone3() syscall
|
|
Commit Message
Randy Dunlap
Aug. 2, 2023, 5:19 a.m. UTC
Add support for the clone3() syscall to prevent a warning from
checksyscalls.sh:
<stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp]
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Christian Brauner <christian@brauner.io>
---
Is there some reason that NIOS2 should not (does not) support clone3()?
arch/nios2/include/uapi/asm/unistd.h | 1 +
1 file changed, 1 insertion(+)
Comments
On Tue, Aug 01, 2023 at 10:19:24PM -0700, Randy Dunlap wrote: > Add support for the clone3() syscall to prevent a warning from > checksyscalls.sh: > > <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp] > > Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > Cc: Dinh Nguyen <dinguyen@kernel.org> > Cc: Christian Brauner <christian@brauner.io> > --- > Is there some reason that NIOS2 should not (does not) support clone3()? Cc Arnd, in case he knows.
On Wed, Aug 2, 2023, at 09:40, Christian Brauner wrote: > On Tue, Aug 01, 2023 at 10:19:24PM -0700, Randy Dunlap wrote: >> Add support for the clone3() syscall to prevent a warning from >> checksyscalls.sh: >> >> <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp] >> >> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >> Cc: Dinh Nguyen <dinguyen@kernel.org> >> Cc: Christian Brauner <christian@brauner.io> >> --- >> Is there some reason that NIOS2 should not (does not) support clone3()? > > Cc Arnd, in case he knows. As far as I remember, you left a few architectures without clone3 during the introduction when there was neither an obvious way to handle the syscall entry nor a maintainer to have a look. Right now, it seems to be missing on alpha, hexagon, ia64, microblaze, nios2, sh and sparc. There are a few architectures that implement a custom entry point for both clone and clone3. The other architectures that provide the generic sys_clone3 also use the generic sys_clone. These are the wrappers I see: # ARC ENTRY(sys_clone3_wrapper) SAVE_CALLEE_SAVED_USER bl @sys_clone3 DISCARD_CALLEE_SAVED_USER GET_CURR_THR_INFO_FLAGS r10 and.f 0, r10, _TIF_SYSCALL_WORK bnz tracesys_exit b .Lret_from_system_call END(sys_clone3_wrapper) # m68k ENTRY(__sys_clone3) SAVE_SWITCH_STACK pea %sp@(SWITCH_STACK_SIZE) jbsr m68k_clone3 lea %sp@(28),%sp rts # mips save_static_function(sys_clone3); # openrisc ENTRY(__sys_clone3) l.movhi r29,hi(sys_clone3) l.j _fork_save_extra_regs_and_call l.ori r29,r29,lo(sys_clone3) # parisc .macro fork_like name ENTRY_CFI(sys_\name\()_wrapper) mfctl %cr30,%r1 ldo TASK_REGS(%r1),%r1 reg_save %r1 mfctl %cr27, %r28 ldil L%sys_\name, %r31 be R%sys_\name(%sr4,%r31) STREG %r28, PT_CR27(%r1) ENDPROC_CFI(sys_\name\()_wrapper) .endm fork_like clone fork_like clone3 Nios3 in turn has a wrapper for sys_clone: ENTRY(sys_clone) SAVE_SWITCH_STACK subi sp, sp, 4 /* make space for tls pointer */ stw r8, 0(sp) /* pass tls pointer (r8) via stack (5th argument) */ call nios2_clone addi sp, sp, 4 RESTORE_SWITCH_STACK ret so my guess would be that it needs the same thing for clone3 as well. Same thing on alpha, ia64 and sparc. On the other hand hexagon, microblaze and sh use the generic sys_clone() and can probably just enable sys_clone3() without extra work unless it's already broken. Arnd
On 8/2/23 01:16, Arnd Bergmann wrote: > On Wed, Aug 2, 2023, at 09:40, Christian Brauner wrote: >> On Tue, Aug 01, 2023 at 10:19:24PM -0700, Randy Dunlap wrote: >>> Add support for the clone3() syscall to prevent a warning from >>> checksyscalls.sh: >>> >>> <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp] >>> >>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >>> Cc: Dinh Nguyen <dinguyen@kernel.org> >>> Cc: Christian Brauner <christian@brauner.io> >>> --- >>> Is there some reason that NIOS2 should not (does not) support clone3()? >> >> Cc Arnd, in case he knows. > > As far as I remember, you left a few architectures without clone3 > during the introduction when there was neither an obvious way to > handle the syscall entry nor a maintainer to have a look. > > Right now, it seems to be missing on alpha, hexagon, ia64, > microblaze, nios2, sh and sparc. > > There are a few architectures that implement a custom entry > point for both clone and clone3. The other architectures that > provide the generic sys_clone3 also use the generic sys_clone. > These are the wrappers I see: > > # ARC > ENTRY(sys_clone3_wrapper) > SAVE_CALLEE_SAVED_USER > bl @sys_clone3 > DISCARD_CALLEE_SAVED_USER > > GET_CURR_THR_INFO_FLAGS r10 > and.f 0, r10, _TIF_SYSCALL_WORK > bnz tracesys_exit > > b .Lret_from_system_call > END(sys_clone3_wrapper) > > # m68k > ENTRY(__sys_clone3) > SAVE_SWITCH_STACK > pea %sp@(SWITCH_STACK_SIZE) > jbsr m68k_clone3 > lea %sp@(28),%sp > rts > > > # mips > save_static_function(sys_clone3); > > # openrisc > ENTRY(__sys_clone3) > l.movhi r29,hi(sys_clone3) > l.j _fork_save_extra_regs_and_call > l.ori r29,r29,lo(sys_clone3) > > # parisc > .macro fork_like name > ENTRY_CFI(sys_\name\()_wrapper) > mfctl %cr30,%r1 > ldo TASK_REGS(%r1),%r1 > reg_save %r1 > mfctl %cr27, %r28 > ldil L%sys_\name, %r31 > be R%sys_\name(%sr4,%r31) > STREG %r28, PT_CR27(%r1) > ENDPROC_CFI(sys_\name\()_wrapper) > .endm > fork_like clone > fork_like clone3 > > Nios3 in turn has a wrapper for sys_clone: > ENTRY(sys_clone) > SAVE_SWITCH_STACK > subi sp, sp, 4 /* make space for tls pointer */ > stw r8, 0(sp) /* pass tls pointer (r8) via stack (5th argument) */ > call nios2_clone > addi sp, sp, 4 > RESTORE_SWITCH_STACK > ret > > so my guess would be that it needs the same thing > for clone3 as well. Same thing on alpha, ia64 and > sparc. On the other hand hexagon, microblaze and sh > use the generic sys_clone() and can probably just > enable sys_clone3() without extra work unless it's > already broken. OK, thanks for the help.
On 8/2/23 10:43, Randy Dunlap wrote: > > > On 8/2/23 01:16, Arnd Bergmann wrote: >> On Wed, Aug 2, 2023, at 09:40, Christian Brauner wrote: >>> On Tue, Aug 01, 2023 at 10:19:24PM -0700, Randy Dunlap wrote: >>>> Add support for the clone3() syscall to prevent a warning from >>>> checksyscalls.sh: >>>> >>>> <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp] >>>> >>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >>>> Cc: Dinh Nguyen <dinguyen@kernel.org> >>>> Cc: Christian Brauner <christian@brauner.io> >>>> --- >>>> Is there some reason that NIOS2 should not (does not) support clone3()? >>> >>> Cc Arnd, in case he knows. >> >> As far as I remember, you left a few architectures without clone3 >> during the introduction when there was neither an obvious way to >> handle the syscall entry nor a maintainer to have a look. >> >> Right now, it seems to be missing on alpha, hexagon, ia64, >> microblaze, nios2, sh and sparc. >> >> There are a few architectures that implement a custom entry >> point for both clone and clone3. The other architectures that >> provide the generic sys_clone3 also use the generic sys_clone. >> These are the wrappers I see: >> >> # ARC >> ENTRY(sys_clone3_wrapper) >> SAVE_CALLEE_SAVED_USER >> bl @sys_clone3 >> DISCARD_CALLEE_SAVED_USER >> >> GET_CURR_THR_INFO_FLAGS r10 >> and.f 0, r10, _TIF_SYSCALL_WORK >> bnz tracesys_exit >> >> b .Lret_from_system_call >> END(sys_clone3_wrapper) >> >> # m68k >> ENTRY(__sys_clone3) >> SAVE_SWITCH_STACK >> pea %sp@(SWITCH_STACK_SIZE) >> jbsr m68k_clone3 >> lea %sp@(28),%sp >> rts >> >> >> # mips >> save_static_function(sys_clone3); >> >> # openrisc >> ENTRY(__sys_clone3) >> l.movhi r29,hi(sys_clone3) >> l.j _fork_save_extra_regs_and_call >> l.ori r29,r29,lo(sys_clone3) >> >> # parisc >> .macro fork_like name >> ENTRY_CFI(sys_\name\()_wrapper) >> mfctl %cr30,%r1 >> ldo TASK_REGS(%r1),%r1 >> reg_save %r1 >> mfctl %cr27, %r28 >> ldil L%sys_\name, %r31 >> be R%sys_\name(%sr4,%r31) >> STREG %r28, PT_CR27(%r1) >> ENDPROC_CFI(sys_\name\()_wrapper) >> .endm >> fork_like clone >> fork_like clone3 >> >> Nios3 in turn has a wrapper for sys_clone: >> ENTRY(sys_clone) >> SAVE_SWITCH_STACK >> subi sp, sp, 4 /* make space for tls pointer */ >> stw r8, 0(sp) /* pass tls pointer (r8) via stack (5th argument) */ >> call nios2_clone >> addi sp, sp, 4 >> RESTORE_SWITCH_STACK >> ret >> >> so my guess would be that it needs the same thing >> for clone3 as well. Same thing on alpha, ia64 and >> sparc. On the other hand hexagon, microblaze and sh >> use the generic sys_clone() and can probably just >> enable sys_clone3() without extra work unless it's >> already broken. > > OK, thanks for the help. > Applied! Thank you, Dinh
diff -- a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h --- a/arch/nios2/include/uapi/asm/unistd.h +++ b/arch/nios2/include/uapi/asm/unistd.h @@ -22,6 +22,7 @@ #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SET_GET_RLIMIT #define __ARCH_WANT_TIME32_SYSCALLS +#define __ARCH_WANT_SYS_CLONE3 /* Use the standard ABI for syscalls */ #include <asm-generic/unistd.h>