* [PATCH RESEND^2] nios2: support clone3() syscall @ 2023-08-02 5:19 Randy Dunlap 2023-08-02 7:40 ` Christian Brauner 0 siblings, 1 reply; 5+ messages in thread From: Randy Dunlap @ 2023-08-02 5:19 UTC (permalink / raw) To: linux-kernel; +Cc: Randy Dunlap, Dinh Nguyen, Christian Brauner 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(+) 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> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND^2] nios2: support clone3() syscall 2023-08-02 5:19 [PATCH RESEND^2] nios2: support clone3() syscall Randy Dunlap @ 2023-08-02 7:40 ` Christian Brauner 2023-08-02 8:16 ` Arnd Bergmann 0 siblings, 1 reply; 5+ messages in thread From: Christian Brauner @ 2023-08-02 7:40 UTC (permalink / raw) To: Randy Dunlap, Arnd Bergmann; +Cc: linux-kernel, Dinh Nguyen, Christian Brauner 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND^2] nios2: support clone3() syscall 2023-08-02 7:40 ` Christian Brauner @ 2023-08-02 8:16 ` Arnd Bergmann 2023-08-02 15:43 ` Randy Dunlap 0 siblings, 1 reply; 5+ messages in thread From: Arnd Bergmann @ 2023-08-02 8:16 UTC (permalink / raw) To: Christian Brauner, Randy Dunlap Cc: linux-kernel, Dinh Nguyen, Christian Brauner 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND^2] nios2: support clone3() syscall 2023-08-02 8:16 ` Arnd Bergmann @ 2023-08-02 15:43 ` Randy Dunlap 2023-08-06 17:52 ` Dinh Nguyen 0 siblings, 1 reply; 5+ messages in thread From: Randy Dunlap @ 2023-08-02 15:43 UTC (permalink / raw) To: Arnd Bergmann, Christian Brauner Cc: linux-kernel, Dinh Nguyen, Christian Brauner 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. -- ~Randy ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND^2] nios2: support clone3() syscall 2023-08-02 15:43 ` Randy Dunlap @ 2023-08-06 17:52 ` Dinh Nguyen 0 siblings, 0 replies; 5+ messages in thread From: Dinh Nguyen @ 2023-08-06 17:52 UTC (permalink / raw) To: Randy Dunlap, Arnd Bergmann, Christian Brauner Cc: linux-kernel, Christian Brauner 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-06 17:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-02 5:19 [PATCH RESEND^2] nios2: support clone3() syscall Randy Dunlap 2023-08-02 7:40 ` Christian Brauner 2023-08-02 8:16 ` Arnd Bergmann 2023-08-02 15:43 ` Randy Dunlap 2023-08-06 17:52 ` Dinh Nguyen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox