frv: copy_thread(): rename 'arg' argument to 'kthread_arg'
PATCH 12/32 hexagon: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/hexagon/kernel/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/hexagon/kernel/process.c +3 -2
@@ -71,7 +71,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)* Copy architecture-specific thread state */ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);struct hexagon_switch_stack *ss;
@@ -94,10 +94,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ss->lr = (unsigned long )ret_from_fork; p->thread.switch_sp = ss;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childregs,0 ,sizeof (struct pt_regs ));/* r24 <- fn, r25 <- arg */ ss->r24 = usp; - ss->r25 = arg; + ss->r25 = kthread_arg;pt_set_kmode (childregs);return 0 ; }
Signature · 1 line
2.0.0.GIT
PATCH 13/32 ia64: copy_thread(): rename 'user_stack_size' argument to 'kthread_arg'
In reply to Alex Dowad'user_stack_size' is very misleading, since the argument is never used for the size of the user stack. Rather, it is an argument which is passed to the main function executed by a newly forked kernel thread. Hence, rename it to 'kthread_arg'.
When forking a new user thread, the kernel thread arg was (uselessly) added to the new user stack pointer. This "worked", since the kernel thread arg is always zero when forking a user thread, but it was obviously not intended.
--- arch/ia64/kernel/process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/ia64/kernel/process.c +7 -4
@@ -300,7 +300,7 @@ ia64_load_extra (struct task_struct *task) }/* -* Copy the state of an ia-64 thread. +* Copy the architecture-specific state of an ia-64 thread. * * We get here through the following call chain: *
@@ -332,7 +332,7 @@ ia64_load_extra (struct task_struct *task)*/ int copy_thread (unsigned long clone_flags, -unsigned long user_stack_base,unsigned long user_stack_size, +unsigned long user_stack_base,unsigned long kthread_arg,struct task_struct *p) {extern char ia64_ret_from_clone;
@@ -376,13 +376,14 @@ copy_thread(unsigned long clone_flags,ia64_drop_fpu (p);/* don't pick up stale state from a CPU's fph */ if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ if (unlikely (!user_stack_base)) {/* fork_idle() called us */ return 0 ; }memset (child_stack,0 ,sizeof (*child_ptregs) +sizeof (*child_stack)); child_stack->r4 = user_stack_base;/* payload */ - child_stack->r5 = user_stack_size;/* argument */ + child_stack->r5 = kthread_arg;/* * Preserve PSR bits, except for bits 32-34 and 37-45, * which we can't read.
@@ -406,6 +407,8 @@ copy_thread(unsigned long clone_flags,return 0 ; } + +/* user thread */ stack = ((struct switch_stack *) regs) -1 ;/* copy parent's switch_stack & pt_regs to child: */ memcpy (child_stack, stack,sizeof (*child_ptregs) +sizeof (*child_stack));
@@ -416,7 +419,7 @@ copy_thread(unsigned long clone_flags,if (clone_flags &CLONE_SETTLS ) child_ptregs->r13 = regs->r16;/* see sys_clone2() in entry.S */ if (user_stack_base) { - child_ptregs->r12 = user_stack_base + user_stack_size -16 ; + child_ptregs->r12 = user_stack_base -16 ; child_ptregs->ar_bspstore = user_stack_base; child_ptregs->ar_rnat =0 ; child_ptregs->loadrs =0 ;
Signature · 1 line
2.0.0.GIT
PATCH 15/32 m68k: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/m68k/kernel/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/m68k/kernel/process.c +7 -2
@@ -129,8 +129,11 @@ asmlinkage int m68k_clone(struct pt_regs *regs) (int __user *)regs->d3, (int __user *)regs->d4); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct fork_frame {struct switch_stack sw;
@@ -153,11 +156,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,memset (frame,0 ,sizeof (struct fork_frame )); frame->regs.sr =PS_S ; frame->sw.a3 = usp;/* function */ - frame->sw.d7 = arg; + frame->sw.d7 = kthread_arg; frame->sw.retpc = (unsigned long )ret_from_kernel_thread; p->thread.usp =0 ;return 0 ; } + +/* user thread */ memcpy(frame, container_of(current_pt_regs(), struct fork_frame, regs),sizeof (struct fork_frame )); frame->regs.d0 =0 ;
Signature · 1 line
2.0.0.GIT
PATCH 16/32 metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/metag/kernel/process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/metag/kernel/process.c +6 -2
@@ -174,8 +174,11 @@ void show_regs(struct pt_regs *regs)show_trace (NULL , (unsigned long *)regs->ctx.AX[0 ].U0, regs); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *tsk) +unsigned long kthread_arg,struct task_struct *tsk) {struct pt_regs *childregs =task_pt_regs (tsk); void *kernel_context = ((void *) childregs +
@@ -204,10 +207,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->ctx.AX[0 ].U0 = (unsigned long ) kernel_context;/* Set D1Ar1=arg and D1RtP=usp (fn) */ childregs->ctx.DX[4 ].U1 = usp; - childregs->ctx.DX[3 ].U1 = arg; + childregs->ctx.DX[3 ].U1 = kthread_arg; tsk->thread.int_depth =2 ;return 0 ; } +/* * Get a pointer to where the new child's register block should have * been pushed.
Signature · 1 line
2.0.0.GIT
PATCH 22/32 parisc: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/parisc/kernel/process.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/parisc/kernel/process.c +6 -4
@@ -181,9 +181,12 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r)return 1 ; } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *cregs = &(p->thread.regs);void *stack =task_stack_page (p);
@@ -195,11 +198,10 @@ copy_thread(unsigned long clone_flags, unsigned long usp,extern void *const child_return;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (cregs,0 ,sizeof (struct pt_regs ));if (!usp)/* idle thread */ return 0 ; - -/* kernel thread */ /* Must exit via ret_from_kernel_thread in order * to call schedule_tail() */
@@ -215,7 +217,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp,#else cregs->gr[26 ] = usp;#endif - cregs->gr[25 ] = arg; + cregs->gr[25 ] = kthread_arg; }else {/* user thread */ /* usp must be word aligned. This also prevents users from
Signature · 1 line
2.0.0.GIT
PATCH 24/32 s390: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/s390/kernel/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/s390/kernel/process.c +7 -2
@@ -87,8 +87,11 @@ void arch_release_task_struct(struct task_struct *tsk) }#endif +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long new_stackp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti;struct fake_frame
@@ -127,12 +130,14 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp, frame->childregs.psw.addr =PSW_ADDR_AMODE | (unsigned long ) kernel_thread_starter; frame->childregs.gprs[9 ] = new_stackp;/* function */ - frame->childregs.gprs[10 ] = arg; + frame->childregs.gprs[10 ] = kthread_arg; frame->childregs.gprs[11 ] = (unsigned long ) do_exit; frame->childregs.orig_gpr2 =-1 ;return 0 ; } + +/* user thread */ frame->childregs = *current_pt_regs (); frame->childregs.gprs[2 ] =0 ;/* child returns 0 on fork. */ frame->childregs.flags =0 ;
Signature · 1 line
2.0.0.GIT
PATCH 26/32 sh: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/sh/kernel/process_32.c | 10 ++++++++-- arch/sh/kernel/process_64.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-)
arch/sh/kernel/process_32.c +8 -2
@@ -123,8 +123,11 @@ EXPORT_SYMBOL(dump_fpu); asmlinkage void ret_from_fork(void); asmlinkage void ret_from_kernel_thread(void); +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);struct pt_regs *childregs;
@@ -146,9 +149,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs =task_pt_regs (p); p->thread.sp = (unsigned long ) childregs;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childregs,0 ,sizeof (struct pt_regs )); p->thread.pc = (unsigned long ) ret_from_kernel_thread; - childregs->regs[4 ] = arg; + childregs->regs[4 ] = kthread_arg; childregs->regs[5 ] = usp; childregs->sr =SR_MD ;#if defined(CONFIG_SH_FPU )
@@ -159,6 +163,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p->thread.fpu_counter =0 ;return 0 ; } + +/* user thread */ *childregs = *current_pt_regs ();if (usp)
arch/sh/kernel/process_64.c +9 -3
@@ -371,8 +371,11 @@ EXPORT_SYMBOL(dump_fpu); asmlinkage void ret_from_fork(void); asmlinkage void ret_from_kernel_thread(void); +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs;
@@ -391,14 +394,17 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p->thread.sp = (unsigned long ) childregs;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childregs,0 ,sizeof (struct pt_regs )); - childregs->regs[2 ] = (unsigned long )arg; - childregs->regs[3 ] = (unsigned long )usp; + childregs->regs[2 ] = kthread_arg; + childregs->regs[3 ] = usp; childregs->sr = (1 <<30 );/* not user_mode */ childregs->sr |=SR_FD ;/* Invalidate FPU flag */ p->thread.pc = (unsigned long ) ret_from_kernel_thread;return 0 ; } + +/* user thread */ *childregs = *current_pt_regs ();/*
Signature · 1 line
2.0.0.GIT
PATCH 27/32 sparc: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/sparc/kernel/process_32.c | 10 ++++++++-- arch/sparc/kernel/process_64.c | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
arch/sparc/kernel/process_32.c +8 -2
@@ -305,8 +305,11 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,extern void ret_from_fork (void );extern void ret_from_kernel_thread (void ); +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long sp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);struct pt_regs *childregs, *regs =current_pt_regs ();
@@ -343,6 +346,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p->thread.kregs = childregs;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ extern int nwindows;unsigned long psr;memset (new_stack,0 ,STACKFRAME_SZ +TRACEREG_SZ );
@@ -350,12 +354,14 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p->thread.current_ds =KERNEL_DS ; ti->kpc = (((unsigned long ) ret_from_kernel_thread) -0x8 ); childregs->u_regs[UREG_G1 ] = sp;/* function */ - childregs->u_regs[UREG_G2 ] = arg; + childregs->u_regs[UREG_G2 ] = kthread_arg; psr = childregs->psr =get_psr (); ti->kpsr = psr |PSR_PIL ; ti->kwim =1 << (((psr &PSR_CWP ) +1 ) % nwindows);return 0 ; } + +/* user thread */ memcpy (new_stack, (char *)regs -STACKFRAME_SZ ,STACKFRAME_SZ +TRACEREG_SZ ); childregs->u_regs[UREG_FP ] = sp; p->thread.flags &= ~SPARC_FLAG_KTHREAD ;
arch/sparc/kernel/process_64.c +4 -2
@@ -613,7 +613,7 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,* Child --> %o0 = parents pid, %o1 = 1 */ int copy_thread (unsigned long clone_flags,unsigned long sp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *t =task_thread_info (p);struct pt_regs *regs =current_pt_regs ();
@@ -633,15 +633,17 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, t->fpsaved[0 ] =0 ;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (child_trap_frame,0 , child_stack_sz);__thread_flag_byte_ptr (t)[TI_FLAG_BYTE_CWP ] = (current_pt_regs ()->tstate +1 ) &TSTATE_CWP ; t->current_ds =ASI_P ; t->kregs->u_regs[UREG_G1 ] = sp;/* function */ - t->kregs->u_regs[UREG_G2 ] = arg; + t->kregs->u_regs[UREG_G2 ] = kthread_arg;return 0 ; } +/* user thread */ parent_sf = ((struct sparc_stackf *) regs) -1 ;memcpy (child_trap_frame, parent_sf, child_stack_sz);if (t->flags & _TIF_32BIT) {
Signature · 1 line
2.0.0.GIT
PATCH 29/32 um: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/um/kernel/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/um/kernel/process.c +7 -2
@@ -149,8 +149,11 @@ void fork_handler(void)userspace (¤t->thread.regs.regs); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long sp, -unsigned long arg,struct task_struct * p) +unsigned long kthread_arg,struct task_struct *p) {void (*handler)(void );int kthread = current->flags &PF_KTHREAD ;
@@ -159,6 +162,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p->thread = (struct thread_struct )INIT_THREAD ;if (!kthread) { +/* user thread */ memcpy (&p->thread.regs.regs,current_pt_regs (),sizeof (p->thread.regs.regs));PT_REGS_SET_SYSCALL_RETURN (&p->thread.regs,0 );
@@ -169,9 +173,10 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,arch_copy_thread (¤t->thread.arch, &p->thread.arch); }else { +/* kernel thread */ get_safe_registers (p->thread.regs.regs.gp, p->thread.regs.regs.fp); p->thread.request.u.thread.proc = (int (*)(void *))sp; - p->thread.request.u.thread.arg = (void *)arg; + p->thread.request.u.thread.arg = (void *)kthread_arg; handler = new_thread_handler; }
Signature · 1 line
2.0.0.GIT
PATCH 11/32 frv: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/frv/kernel/process.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/frv/kernel/process.c +4 -3
@@ -123,10 +123,10 @@ inline unsigned long user_stack(const struct pt_regs *regs) }/* -* set up the kernel stack and exception frames for a new process +* Copy architecture-specific thread state */ int copy_thread (unsigned long clone_flags, -unsigned long usp,unsigned long arg, +unsigned long usp,unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs;
@@ -145,8 +145,9 @@ int copy_thread(unsigned long clone_flags, p->thread.frame0 = childregs;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ childregs->gr9 = usp;/* function */ - childregs->gr8 = arg; + childregs->gr8 = kthread_arg; p->thread.pc = (unsigned long ) ret_from_kernel_thread;save_user_regs (p->thread.user);return 0 ;
Signature · 1 line
2.0.0.GIT
PATCH 15/32 m68k: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/m68k/kernel/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/m68k/kernel/process.c +7 -2
@@ -129,8 +129,11 @@ asmlinkage int m68k_clone(struct pt_regs *regs) (int __user *)regs->d3, (int __user *)regs->d4); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct fork_frame {struct switch_stack sw;
@@ -153,11 +156,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,memset (frame,0 ,sizeof (struct fork_frame )); frame->regs.sr =PS_S ; frame->sw.a3 = usp;/* function */ - frame->sw.d7 = arg; + frame->sw.d7 = kthread_arg; frame->sw.retpc = (unsigned long )ret_from_kernel_thread; p->thread.usp =0 ;return 0 ; } + +/* user thread */ memcpy(frame, container_of(current_pt_regs(), struct fork_frame, regs),sizeof (struct fork_frame )); frame->regs.d0 =0 ;
Signature · 1 line
2.0.0.GIT
PATCH 18/32 mips: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/mips/kernel/process.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/mips/kernel/process.c +8 -2
@@ -107,8 +107,11 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)return 0 ; } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);struct pt_regs *childregs, *regs =current_pt_regs ();
@@ -123,11 +126,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childksp = (unsigned long ) childregs; p->thread.cp0_status =read_c0_status () & ~(ST0_CU2 |ST0_CU1 );if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ unsigned long status = p->thread.cp0_status;memset (childregs,0 ,sizeof (struct pt_regs )); ti->addr_limit =KERNEL_DS ; p->thread.reg16 = usp;/* fn */ - p->thread.reg17 = arg; + p->thread.reg17 = kthread_arg; p->thread.reg29 = childksp; p->thread.reg31 = (unsigned long ) ret_from_kernel_thread;#if defined(CONFIG_CPU_R3000 ) || defined(CONFIG_CPU_TX39XX )
@@ -139,6 +143,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->cp0_status = status;return 0 ; } + +/* user thread */ *childregs = *regs; childregs->regs[7 ] =0 ;/* Clear error flag */ childregs->regs[2 ] =0 ;/* Child gets zero as return value */
Signature · 1 line
2.0.0.GIT
PATCH 20/32 nios2: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/nios2/kernel/process.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/nios2/kernel/process.c +8 -2
@@ -97,8 +97,12 @@ void flush_thread(void)set_fs (USER_DS ); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags, -unsigned long usp,unsigned long arg,struct task_struct *p) +unsigned long usp,unsigned long kthread_arg, +struct task_struct *p) {struct pt_regs *childregs =task_pt_regs (p);struct pt_regs *regs;
@@ -107,11 +111,12 @@ int copy_thread(unsigned long clone_flags, ((struct switch_stack *)childregs) -1 ;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childstack,0 ,sizeof (struct switch_stack ) +sizeof (struct pt_regs )); childstack->r16 = usp;/* fn */ - childstack->r17 = arg; + childstack->r17 = kthread_arg; childstack->ra = (unsigned long ) ret_from_kernel_thread; childregs->estatus =STATUS_PIE ; childregs->sp = (unsigned long ) childstack;
@@ -121,6 +126,7 @@ int copy_thread(unsigned long clone_flags,return 0 ; } +/* user thread */ regs =current_pt_regs (); *childregs = *regs; childregs->r2 =0 ;/* Set the return value for the child. */
Signature · 1 line
2.0.0.GIT
PATCH 23/32 powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/powerpc/kernel/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/powerpc/kernel/process.c +7 -2
@@ -1114,8 +1114,11 @@ static void setup_ksp_vsid(struct task_struct *p, unsigned long sp)*/ extern unsigned long dscr_default;/* defined in arch/powerpc/kernel/sysfs.c */ +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs, *kregs;extern void ret_from_fork (void );
@@ -1127,6 +1130,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, sp -=sizeof (struct pt_regs ); childregs = (struct pt_regs *) sp;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ struct thread_info *ti = (void *)task_stack_page (p);memset (childregs,0 ,sizeof (struct pt_regs )); childregs->gpr[1 ] = sp +sizeof (struct pt_regs );
@@ -1137,11 +1141,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,clear_tsk_thread_flag (p,TIF_32BIT ); childregs->softe =1 ;#endif - childregs->gpr[15 ] = arg; + childregs->gpr[15 ] = kthread_arg; p->thread.regs =NULL ;/* no user register state */ ti->flags |= _TIF_RESTOREALL; f = ret_from_kernel_thread; }else { +/* user thread */ struct pt_regs *regs =current_pt_regs ();CHECK_FULL_REGS (regs); *childregs = *regs;
Signature · 1 line
2.0.0.GIT
PATCH 25/32 score: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/score/kernel/process.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/score/kernel/process.c +5 -3
@@ -66,10 +66,10 @@ void exit_thread(void) {}void flush_thread (void ) {}/* -* set up the kernel stack and exception frames for a new process +* Copy architecture-specific thread state */ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);struct pt_regs *childregs =task_pt_regs (p);
@@ -77,11 +77,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p->thread.reg0 = (unsigned long ) childregs;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childregs,0 ,sizeof (struct pt_regs )); p->thread.reg12 = usp; - p->thread.reg13 = arg; + p->thread.reg13 = kthread_arg; p->thread.reg3 = (unsigned long ) ret_from_kernel_thread; }else { +/* user thread */ *childregs = *current_pt_regs (); childregs->regs[7 ] =0 ;/* Clear error flag */ childregs->regs[4 ] =0 ;/* Child gets zero as return value */
Signature · 1 line
2.0.0.GIT
PATCH 28/32 tile: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/tile/kernel/process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/tile/kernel/process.c +7 -4
@@ -97,8 +97,11 @@ void arch_release_thread_info(struct thread_info *info)static void save_arch_state (struct thread_struct *t); +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long sp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs =task_pt_regs (p);unsigned long ksp;
@@ -130,15 +133,15 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,memset (&callee_regs[2 ],0 , (CALLEE_SAVED_REGS_COUNT -2 ) *sizeof (unsigned long )); callee_regs[0 ] = sp;/* r30 = function */ - callee_regs[1 ] = arg;/* r31 = arg */ + callee_regs[1 ] = kthread_arg;/* r31 = arg */ childregs->ex1 =PL_ICS_EX1 (KERNEL_PL ,0 ); p->thread.pc = (unsigned long ) ret_from_kernel_thread;return 0 ; }/* -* Start new thread in ret_from_fork so it schedules properly -* and then return from interrupt like the parent. +* user thread: start in ret_from_fork so it schedules properly +* and then returns from interrupt like the parent. */ p->thread.pc = (unsigned long ) ret_from_fork;
Signature · 1 line
2.0.0.GIT
PATCH 30/32 unicore32: copy_thread(): rename 'stk_sz' argument to 'kthread_arg'
In reply to Alex Dowad'stk_sz' is misleading, since this argument is never used for a stack size. Rather, it is an argument passed to the main function executed by a new kernel thread. Therefore, rename it to 'kthread_arg'.
--- arch/unicore32/kernel/process.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/unicore32/kernel/process.c +7 -2
@@ -227,9 +227,12 @@ void release_thread(struct task_struct *dead_task) asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread"); +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long stack_start, -unsigned long stk_sz,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *thread =task_thread_info (p);struct pt_regs *childregs =task_pt_regs (p);
@@ -237,11 +240,13 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,memset (&thread->cpu_context,0 ,sizeof (struct cpu_context_save )); thread->cpu_context.sp = (unsigned long )childregs;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ thread->cpu_context.pc = (unsigned long )ret_from_kernel_thread; thread->cpu_context.r4 = stack_start; - thread->cpu_context.r5 = stk_sz; + thread->cpu_context.r5 = kthread_arg;memset (childregs,0 ,sizeof (struct pt_regs )); }else { +/* user thread */ thread->cpu_context.pc = (unsigned long )ret_from_fork; *childregs = *current_pt_regs (); childregs->UCreg_00 =0 ;
Signature · 1 line
2.0.0.GIT
PATCH 31/32 x86: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/x86/kernel/process_32.c | 9 +++++++-- arch/x86/kernel/process_64.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
arch/x86/kernel/process_32.c +7 -2
@@ -129,8 +129,11 @@ void release_thread(struct task_struct *dead_task)release_vm86_irqs (dead_task); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long sp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs =task_pt_regs (p);struct task_struct *tsk;
@@ -149,13 +152,15 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, childregs->es = __USER_DS; childregs->fs = __KERNEL_PERCPU; childregs->bx = sp;/* function */ - childregs->bp = arg; + childregs->bp = kthread_arg; childregs->orig_ax =-1 ; childregs->cs = __KERNEL_CS |get_kernel_rpl (); childregs->flags =X86_EFLAGS_IF |X86_EFLAGS_FIXED ; p->thread.io_bitmap_ptr =NULL ;return 0 ; } + +/* user thread */ *childregs = *current_pt_regs (); childregs->ax =0 ;if (sp)
arch/x86/kernel/process_64.c +7 -2
@@ -151,8 +151,11 @@ static inline u32 read_32bit_tls(struct task_struct *t, int tls)return get_desc_base (&t->thread.tls_array[tls]); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long sp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {int err;struct pt_regs *childregs;
@@ -179,12 +182,14 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, childregs->sp = (unsigned long )childregs; childregs->ss = __KERNEL_DS; childregs->bx = sp;/* function */ - childregs->bp = arg; + childregs->bp = kthread_arg; childregs->orig_ax =-1 ; childregs->cs = __KERNEL_CS |get_kernel_rpl (); childregs->flags =X86_EFLAGS_IF |X86_EFLAGS_FIXED ;return 0 ; } + +/* user thread */ *childregs = *current_pt_regs (); childregs->ax =0 ;
Signature · 1 line
2.0.0.GIT
PATCH 32/32 xtensa: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadRename the 'thread_fn_arg' it to 'kthread_arg' for consistency with do_fork() and other arch-specific implementations of copy_thread().
--- arch/xtensa/kernel/process.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/xtensa/kernel/process.c +6 -5
@@ -147,7 +147,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) }/* -* Copy thread. +* Copy architecture-specific thread state * * There are two modes in which this function is called: * 1) Userspace thread creation,
@@ -156,7 +156,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)* in the clone_flags) and set up passed usp in the childregs. * 2) Kernel thread creation, * regs == NULL, usp_thread_fn is the function to run in the new thread -* and thread_fn_arg is its parameter. +* and kthread_arg is its parameter. * childregs are not used for the kernel threads. * * The stack layout for the new thread looks like this:
@@ -187,9 +187,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)* One solution is to spill windows to the parent stack, but that's fairly * involved. Much simpler to just not copy those live frames across. */ -int copy_thread (unsigned long clone_flags,unsigned long usp_thread_fn, -unsigned long thread_fn_arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs =task_pt_regs (p);
@@ -204,6 +203,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, p->thread.sp = (unsigned long )childregs;if (!(p->flags &PF_KTHREAD )) { +/* user thread */ struct pt_regs *regs =current_pt_regs ();unsigned long usp = usp_thread_fn ? usp_thread_fn : regs->areg[1 ];
@@ -254,13 +254,14 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,if (clone_flags &CLONE_SETTLS ) childregs->threadptr = childregs->areg[5 ]; }else { +/* kernel thread */ p->thread.ra =MAKE_RA_FOR_CALL ( (unsigned long )ret_from_kernel_thread,1 );/* pass parameters to ret_from_kernel_thread: * a2 = thread_fn, a3 = thread_fn arg */ - *((int *)childregs -1 ) = thread_fn_arg; + *((int *)childregs -1 ) = kthread_arg; *((int *)childregs -2 ) = usp_thread_fn;/* Childregs are only used when we're going to userspace
Signature · 1 line
2.0.0.GIT
PATCH 21/32 openrisc: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/openrisc/kernel/process.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/openrisc/kernel/process.c +5 -4
@@ -114,7 +114,7 @@ extern asmlinkage void ret_from_fork(void);* copy_thread * @clone_flags: flags * @usp: user stack pointer or fn for kernel thread -* @arg: arg to fn for kernel thread; always NULL for userspace thread +* @kthread_arg: arg to fn for kernel thread; always NULL for userspace thread * @p: the newly created task * @regs: CPU context to copy for userspace thread; always NULL for kthread *
@@ -140,10 +140,9 @@ extern asmlinkage void ret_from_fork(void);* below); ret_from_fork will then continue its execution causing the * 'kernel thread' to return to userspace as a userspace thread. */ -int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *userregs;struct pt_regs *kregs;
@@ -165,10 +164,12 @@ copy_thread(unsigned long clone_flags, unsigned long usp, kregs = (struct pt_regs *)sp;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (kregs,0 ,sizeof (struct pt_regs )); kregs->gpr[20 ] = usp;/* fn, kernel thread */ - kregs->gpr[22 ] = arg; + kregs->gpr[22 ] = kthread_arg; }else { +/* user thread */ *userregs = *current_pt_regs ();if (usp)
Signature · 1 line
2.0.0.GIT
PATCH 19/32 mn10300: copy_thread(): rename 'ustk_size' argument to 'kthread_arg'
In reply to Alex Dowad'ustk_size' is misleading, since this argument is never used for a user stack size. Rather, it is an argument passed to the main function executed by a new kernel thread. Therefore, rename it to 'kthread_arg'.
--- arch/mn10300/kernel/process.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/mn10300/kernel/process.c +6 -4
@@ -137,11 +137,10 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) }/* -* set up the kernel stack for a new thread and copy arch-specific thread -* control information +* Copy architecture-specific thread state */ int copy_thread (unsigned long clone_flags, -unsigned long c_usp,unsigned long ustk_size, +unsigned long c_usp,unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);
@@ -164,14 +163,17 @@ int copy_thread(unsigned long clone_flags, p->thread.usp = c_usp;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (c_regs,0 ,sizeof (struct pt_regs )); c_regs->a0 = c_usp;/* function */ - c_regs->d0 = ustk_size;/* argument */ + c_regs->d0 = kthread_arg;local_save_flags (c_regs->epsw); c_regs->epsw |=EPSW_IE |EPSW_IM_7 ; p->thread.pc = (unsigned long ) ret_from_kernel_thread;return 0 ; } + +/* user thread */ *c_regs = *current_pt_regs ();if (c_usp) c_regs->sp = c_usp;
Signature · 1 line
2.0.0.GIT
PATCH 17/32 microblaze: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/microblaze/kernel/process.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/microblaze/kernel/process.c +8 -4
@@ -51,20 +51,22 @@ void flush_thread(void) { } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct pt_regs *childregs =task_pt_regs (p);struct thread_info *ti =task_thread_info (p);if (unlikely (p->flags &PF_KTHREAD )) { -/* if we're creating a new kernel thread then just zeroing all -* the registers. That's OK for a brand new thread.*/ +/* kernel thread: just zero all the registers */ memset (childregs,0 ,sizeof (struct pt_regs ));memset (&ti->cpu_context,0 ,sizeof (struct cpu_context )); ti->cpu_context.r1 = (unsigned long )childregs; ti->cpu_context.r20 = (unsigned long )usp;/* fn */ - ti->cpu_context.r19 = (unsigned long )arg; + ti->cpu_context.r19 = kthread_arg; childregs->pt_mode =1 ;local_save_flags (childregs->msr);#ifdef CONFIG_MMU
@@ -73,6 +75,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ti->cpu_context.r15 = (unsigned long )ret_from_kernel_thread -8 ;return 0 ; } + +/* user thread */ *childregs = *current_pt_regs ();if (usp) childregs->r1 = usp;
Signature · 1 line
2.0.0.GIT
PATCH 14/32 m32r: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()).
--- arch/m32r/kernel/process.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/m32r/kernel/process.c +7 -3
@@ -128,21 +128,25 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)return 0 ;/* Task didn't use the fpu at all. */ } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long spu, -unsigned long arg,struct task_struct *tsk) +unsigned long kthread_arg,struct task_struct *tsk) {struct pt_regs *childregs =task_pt_regs (tsk);extern void ret_from_fork (void );extern void ret_from_kernel_thread (void );if (unlikely (tsk->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childregs,0 ,sizeof (struct pt_regs )); childregs->psw =M32R_PSW_BIE ; childregs->r1 = spu;/* fn */ - childregs->r0 = arg; + childregs->r0 = kthread_arg; tsk->thread.lr = (unsigned long )ret_from_kernel_thread; }else { -/* Copy registers */ +/* user thread: copy registers */ *childregs = *current_pt_regs ();if (spu) childregs->spu = spu;
Signature · 1 line
2.0.0.GIT
Re: [PATCH 13/32] ia64: copy_thread(): rename 'user_stack_size' argument to 'kthread_arg'
In reply to Alex DowadSorry, this patch was in error. (I learned about the IA64-only clone2 syscall too late.)
Please disregard. Thanks! Alex Dowad
Quoted 70 lines · Alex Dowad
'
user_stack_size' is very misleading, since the argument is never used for the size of the user stack. Rather, it is an argument which is passed to the main function executed by a newly forked kernel thread. Hence, rename it to 'kthread_arg'.When forking a new user thread, the kernel thread arg was (uselessly) added to the new user stack pointer. This "worked", since the kernel thread arg is always zero when forking a user thread, but it was obviously not intended.
Signed-off-by Alex Dowad <[email protected]>--- arch/ia64/kernel/process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)arch/ia64/kernel/process.c +7
-4@@ -300,7 +300,7 @@ ia64_load_extra (struct task_struct *task) }/* -* Copy the state of an ia-64 thread. +* Copy the architecture-specific state of an ia-64 thread. * * We get here through the following call chain: * @@ -332,7 +332,7 @@ ia64_load_extra (struct task_struct *task)*/ int copy_thread (unsigned long clone_flags, -unsigned long user_stack_base,unsigned long user_stack_size, +unsigned long user_stack_base,unsigned long kthread_arg,struct task_struct *p) {extern char ia64_ret_from_clone;@@ -376,13 +376,14 @@ copy_thread(unsigned long clone_flags,ia64_drop_fpu (p);/* don't pick up stale state from a CPU's fph */ if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ if (unlikely (!user_stack_base)) {/* fork_idle() called us */ return 0 ; }memset (child_stack,0 ,sizeof (*child_ptregs) +sizeof (*child_stack)); child_stack->r4 = user_stack_base;/* payload */ - child_stack->r5 = user_stack_size;/* argument */ + child_stack->r5 = kthread_arg;/* * Preserve PSR bits, except for bits 32-34 and 37-45, * which we can't read. @@ -406,6 +407,8 @@ copy_thread(unsigned long clone_flags,return 0 ; } + +/* user thread */ stack = ((struct switch_stack *) regs) -1 ;/* copy parent's switch_stack & pt_regs to child: */ memcpy (child_stack, stack,sizeof (*child_ptregs) +sizeof (*child_stack));@@ -416,7 +419,7 @@ copy_thread(unsigned long clone_flags,if (clone_flags &CLONE_SETTLS ) child_ptregs->r13 = regs->r16;/* see sys_clone2() in entry.S */ if (user_stack_base) { - child_ptregs->r12 = user_stack_base + user_stack_size -16 ; + child_ptregs->r12 = user_stack_base -16 ; child_ptregs->ar_bspstore = user_stack_base; child_ptregs->ar_rnat =0 ; child_ptregs->loadrs =0 ;
Re: [PATCH 16/32] metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadQuoted 27 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).Signed-off-by Alex Dowad <[email protected]>--- arch/metag/kernel/process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/metag/kernel/process.c +4
-1@@ -174,8 +174,11 @@ void show_regs(struct pt_regs *regs)show_trace (NULL , (unsigned long *)regs->ctx.AX[0 ].U0, regs); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *tsk) +unsigned long kthread_arg,struct task_struct *tsk) {struct pt_regs *childregs =task_pt_regs (tsk); void *kernel_context = ((void *) childregs +
arch/metag/kernel/process.c int copy_thread(unsigned long clone_flags, unsigned long usp, · line 208
Quoted 2 lines
arch/metag/kernel/process.c +0
-0@@ -204,10 +207,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->ctx.AX[0 ].U0 = (unsigned long ) kernel_context;/* Set D1Ar1=arg and D1RtP=usp (fn) */
Please update this comment too (ctx.DX[3].U1 stores the D1Ar1 register).
Other than that:
I'll assume you plan to get all these patches merged together rather than via individual arch trees unless you say otherwise.
Cheers
James
Quoted 11 lines
arch/metag/kernel/process.c +2
-1childregs->ctx.DX[4 ].U1 = usp; - childregs->ctx.DX[3 ].U1 = arg; + childregs->ctx.DX[3 ].U1 = kthread_arg; tsk->thread.int_depth =2 ;return 0 ; } +/* * Get a pointer to where the new child's register block should have * been pushed.
PATCH v2 16/32 metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity.
---
James Hogan,
Thanks for reviewing this patch. The comment has been updated as you suggested.
You said: "I'll assume you plan to get all these patches merged together rather than via individual arch trees..." The truth is that I am as green as green can be and have no idea how I plan to get these patches merged. I was just reading the Linux source and saw what looked like an opportunity to make the code a tiny bit easier to read. If you have any suggestions on how to proceed, please let me know.
Kind regards, Alex Dowad
arch/metag/kernel/process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/metag/kernel/process.c +7 -3
@@ -174,8 +174,11 @@ void show_regs(struct pt_regs *regs)show_trace (NULL , (unsigned long *)regs->ctx.AX[0 ].U0, regs); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *tsk) +unsigned long kthread_arg,struct task_struct *tsk) {struct pt_regs *childregs =task_pt_regs (tsk); void *kernel_context = ((void *) childregs +
@@ -204,10 +207,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->ctx.AX[0 ].U0 = (unsigned long ) kernel_context; -/* Set D1Ar1=arg and D1RtP=usp (fn) */ +/* Set D1Ar1=kthread_arg and D1RtP=usp (fn) */ childregs->ctx.DX[4 ].U1 = usp; - childregs->ctx.DX[3 ].U1 = arg; + childregs->ctx.DX[3 ].U1 = kthread_arg; tsk->thread.int_depth =2 ;return 0 ; } +/* * Get a pointer to where the new child's register block should have * been pushed.
Signature · 1 line
2.0.0.GIT
Re: [PATCHv2 16/32] metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
Hi Alex,
Quoted 8 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity.Signed-off-by Alex Dowad <[email protected]>---
James Hogan,
Quoted 7 lines
Thanks for reviewing this patch. The comment has been updated as you suggested.
You said: "I'll assume you plan to get all these patches merged together rather than via individual arch trees..." The truth is that I am as green as green can be and have no idea how I plan to get these patches merged. I was just reading the Linux source and saw what looked like an opportunity to make the code a tiny bit easier to read. If you have any suggestions on how to proceed, please let me know.
I guess there are 3 main paths:
1) Ask individual arch maintainers to apply the patches if possible, since it doesn't have dependencies on other patches you're submitting.
2) Gather acks from maintainers for the remaining patches and ask Andrew Morton or another relevant maintainer to apply them (Andrew often picks up misc patches like this I believe).
3) Or gather acks for remaining patches and send a pull request to Linus yourself during the next merge window.
Btw, the whitespace seems to be corrupted here, so the patch won't apply:
Quoted 1 line
- /* Set D1Ar1=arg and D1RtP=usp (fn) */
^^^ currently this is indented with tabs not spaces
arch/metag/kernel/process.c int copy_thread(unsigned long clone_flags, unsigned long usp, · line 208
Quoted 1 line
arch/metag/kernel/process.c +1
-0+/* Set D1Ar1=kthread_arg and D1RtP=usp (fn) */
^^^ and this has a space before a tab
Cheers
James
Quoted 11 lines
arch/metag/kernel/process.c +2
-1childregs->ctx.DX[4 ].U1 = usp; - childregs->ctx.DX[3 ].U1 = arg; + childregs->ctx.DX[3 ].U1 = kthread_arg; tsk->thread.int_depth =2 ;return 0 ; } +/* * Get a pointer to where the new child's register block should have * been pushed.
Re: [PATCHv2 16/32] metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
Quoted 28 lines · James Hogan
Hi Alex,
Quoted 8 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity.Signed-off-by Alex Dowad <[email protected]>---
James Hogan,
Quoted 7 lines
Thanks for reviewing this patch. The comment has been updated as you suggested.
You said: "I'll assume you plan to get all these patches merged together rather than via individual arch trees..." The truth is that I am as green as green can be and have no idea how I plan to get these patches merged. I was just reading the Linux source and saw what looked like an opportunity to make the code a tiny bit easier to read. If you have any suggestions on how to proceed, please let me know.
I guess there are 3 main paths:
1) Ask individual arch maintainers to apply the patches if possible, since it doesn't have dependencies on other patches you're submitting.
2) Gather acks from maintainers for the remaining patches and ask Andrew Morton or another relevant maintainer to apply them (Andrew often picks up misc patches like this I believe).
3) Or gather acks for remaining patches and send a pull request to Linus yourself during the next merge window.
Quoted 1 line
Btw, the whitespace seems to be corrupted here, so the patch won't apply:
Grrr. Sending again.
Thanks for the pointers on merge workflow. I doubt that I will get the attention of each and every arch maintainer, but let's see what will happen. Thanks again.
Quoted 9 lines
Quoted 2 lines
- /* Set D1Ar1=arg and D1RtP=usp (fn) */
^^^ currently this is indented with tabs not spaces
arch/metag/kernel/process.c int copy_thread(unsigned long clone_flags, unsigned long usp, · line 208
Quoted 1 line
arch/metag/kernel/process.c +1
-0+/* Set D1Ar1=kthread_arg and D1RtP=usp (fn) */ ^^^ and this has a space before a tab
Cheers
James
PATCH v3 16/32 metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to James HoganThe 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity.
---
Fixed problem with whitespace, sending again. AD
arch/metag/kernel/process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/metag/kernel/process.c +7 -3
@@ -174,8 +174,11 @@ void show_regs(struct pt_regs *regs)show_trace (NULL , (unsigned long *)regs->ctx.AX[0 ].U0, regs); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *tsk) +unsigned long kthread_arg,struct task_struct *tsk) {struct pt_regs *childregs =task_pt_regs (tsk); void *kernel_context = ((void *) childregs +
@@ -204,10 +207,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->ctx.AX[0 ].U0 = (unsigned long ) kernel_context; -/* Set D1Ar1=arg and D1RtP=usp (fn) */ +/* Set D1Ar1=kthread_arg and D1RtP=usp (fn) */ childregs->ctx.DX[4 ].U1 = usp; - childregs->ctx.DX[3 ].U1 = arg; + childregs->ctx.DX[3 ].U1 = kthread_arg; tsk->thread.int_depth =2 ;return 0 ; } +/* * Get a pointer to where the new child's register block should have * been pushed.
Signature · 1 line
2.0.0.GIT
Re: [PATCHv3 16/32] metag: copy_thread(): rename 'arg' argument to 'kthread_arg'
Quoted 29 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity.Signed-off-by Alex Dowad <[email protected]>---
Fixed problem with whitespace, sending again. AD
arch/metag/kernel/process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/metag/kernel/process.c +4
-1@@ -174,8 +174,11 @@ void show_regs(struct pt_regs *regs)show_trace (NULL , (unsigned long *)regs->ctx.AX[0 ].U0, regs); } +/* +* Copy architecture-specific thread state +*/ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *tsk) +unsigned long kthread_arg,struct task_struct *tsk) {struct pt_regs *childregs =task_pt_regs (tsk); void *kernel_context = ((void *) childregs +
arch/metag/kernel/process.c int copy_thread(unsigned long clone_flags, unsigned long usp, · line 208
Quoted 3 lines
arch/metag/kernel/process.c +1
-1@@ -204,10 +207,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs->ctx.AX[0 ].U0 = (unsigned long ) kernel_context; -/* Set D1Ar1=arg and D1RtP=usp (fn) */ +/* Set D1Ar1=kthread_arg and D1RtP=usp (fn) */
FYI this still has a space before the tab, and isn't indented to the same level as the surrounding code, but I'll just fix that up when I apply it.
Thanks
James
Quoted 11 lines
arch/metag/kernel/process.c +2
-1childregs->ctx.DX[4 ].U1 = usp; - childregs->ctx.DX[3 ].U1 = arg; + childregs->ctx.DX[3 ].U1 = kthread_arg; tsk->thread.int_depth =2 ;return 0 ; } +/* * Get a pointer to where the new child's register block should have * been pushed.
Re: [PATCH 12/32] hexagon: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadQuoted 38 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).Signed-off-by Alex Dowad <[email protected]>--- arch/hexagon/kernel/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/hexagon/kernel/process.c +3
-2@@ -71,7 +71,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)* Copy architecture-specific thread state */ int copy_thread (unsigned long clone_flags,unsigned long usp, -unsigned long arg,struct task_struct *p) +unsigned long kthread_arg,struct task_struct *p) {struct thread_info *ti =task_thread_info (p);struct hexagon_switch_stack *ss;@@ -94,10 +94,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ss->lr = (unsigned long )ret_from_fork; p->thread.switch_sp = ss;if (unlikely (p->flags &PF_KTHREAD )) { +/* kernel thread */ memset (childregs,0 ,sizeof (struct pt_regs ));/* r24 <- fn, r25 <- arg */ ss->r24 = usp; - ss->r25 = arg; + ss->r25 = kthread_arg;pt_set_kmode (childregs);return 0 ; }Signature · 1 line
2.0.0.GIT
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 28/32] tile: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadQuoted 8 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).Signed-off-by Alex Dowad<[email protected]>--- arch/tile/kernel/process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
If you would prefer me to take this into the tile tree, let me know, and I am happy to do so.
Signature · 2 lines
Chris Metcalf, EZChip Semiconductor http://www.ezchip.com
Re: [PATCH 28/32] tile: copy_thread(): rename 'arg' argument to 'kthread_arg'
Quoted 5 lines · Chris Metcalf
Quoted 4 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).
Quoted 9 lines
Quoted 4 lines
Signed-off-by Alex Dowad<[email protected]>--- arch/tile/kernel/process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)Acked-by Chris Metcalf <[email protected]>If you would prefer me to take this into the tile tree, let me know, and I am happy to do so.
Hi Chris,
Thanks for your kind offer. I am a 100% genuine true-blue kernel newbie and have no idea whether a change like this should be merged individually by each arch maintainer, or all together at some point upstream (or is it downstream? I'm not sure about my streams). Do you have any suggestion?
Thank you again! AD
Michael Ellerman
reviewerRe: [23/32] powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadQuoted 3 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).
I don't understand the bit about consistency with do_fork() ?
Otherwise it looks fine.
cheers
Re: [23/32] powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
Quoted 6 lines · Michael Ellerman
Quoted 3 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).I don't understand the bit about consistency with
do_fork()?
This series of patches includes one patch which renames the arg for do_fork(), and others which rename the same arg for each arch-specific implementation of copy_thread(). So if all of them are accepted and merged, then all will be consistent. If only some of the patches are accepted, I will rewrite the commit message so it doesn't mention "consistency".
Thanks! AD
Quoted 4 lines
Otherwise it looks fine.
cheers
Re: [PATCH 28/32] tile: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadQuoted 14 lines · Alex Dowad
Quoted 12 lines · Chris Metcalf
Quoted 8 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).Signed-off-by Alex Dowad<[email protected]>--- arch/tile/kernel/process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)Acked-by Chris Metcalf <[email protected]>
Quoted 7 lines
Quoted 2 lines
If you would prefer me to take this into the tile tree, let me know, and I am happy to do so.
Hi Chris,
Thanks for your kind offer. I am a 100% genuine true-blue kernel newbie and have no idea whether a change like this should be merged individually by each arch maintainer, or all together at some point upstream (or is it downstream? I'm not sure about my streams). Do you have any suggestion?
Thank you again! AD
I think James Hogan's replies were on-target [1]. My sense is that since it's a cleanup, and since you're trying for consistency, if you can gather up a few Acked-by's from maintainers, it probably makes sense to have it taken as a series.
[1] https://lkml.org/lkml/2015/3/16/477
Signature · 2 lines
Chris Metcalf, EZChip Semiconductor http://www.ezchip.com
Michael Ellerman
reviewerRe: [23/32] powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
In reply to Alex DowadQuoted 6 lines · Alex Dowad
Quoted 5 lines · Michael Ellerman
Quoted 3 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).
Quoted 8 lines
Quoted 1 line
I don't understand the bit about consistency with
do_fork()?This series of patches includes one patch which renames the arg for
do_fork(), and others which rename the same arg for each arch-specific implementation ofcopy_thread(). So if all of them are accepted and merged, then all will be consistent. If only some of the patches are accepted, I will rewrite the commit message so it doesn't mention "consistency".
Ah OK, I only got patch 23, so I missed the context of the whole series.
I'll apply this one to the powerpc tree.
cheers
Re: [23/32] powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
Quoted 15 lines · Michael Ellerman
Quoted 6 lines · Alex Dowad
Quoted 5 lines · Michael Ellerman
Quoted 3 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).Quoted 8 lines
Quoted 2 lines
I don't understand the bit about consistency with
do_fork()?This series of patches includes one patch which renames the arg for
do_fork(), and others which rename the same arg for each arch-specific implementation ofcopy_thread(). So if all of them are accepted and merged, then all will be consistent. If only some of the patches are accepted, I will rewrite the commit message so it doesn't mention "consistency".
Quoted 4 lines
Ah OK, I only got patch 23, so I missed the context of the whole series.
I'll apply this one to the powerpc tree.
Dear M. Ellerman, sorry for not replying promptly. If you would like to apply this directly to the powerpc tree, that is fine, but can I edit the commit message to remove the mention of 'consistency'? I doubt that all 30+ archs will ever merge this change. Thanks, Alex
Michael Ellerman
reviewerRe: [23/32] powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
Quoted 16 lines · Alex Dowad
Quoted 15 lines · Michael Ellerman
Quoted 14 lines · Alex Dowad
Quoted 7 lines · Michael Ellerman
Quoted 3 lines · Alex Dowad
The 'arg' argument to
copy_thread()is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency withdo_fork()and other arch-specific implementations ofcopy_thread()).I don't understand the bit about consistency with
do_fork()?This series of patches includes one patch which renames the arg for
do_fork(), and others which rename the same arg for each arch-specific implementation ofcopy_thread(). So if all of them are accepted and merged, then all will be consistent. If only some of the patches are accepted, I will rewrite the commit message so it doesn't mention "consistency".
Quoted 8 lines
Quoted 3 lines
Ah OK, I only got patch 23, so I missed the context of the whole series.
I'll apply this one to the powerpc tree.
Dear M. Ellerman, sorry for not replying promptly. If you would like to apply this directly to the powerpc tree, that is fine, but can I edit the commit message to remove the mention of 'consistency'? I doubt that all 30+ archs will ever merge this change. Thanks, Alex
I merged it last week:
And I edited the commit message more or less as you describe.
And feel free to call me Michael or mpe :)
cheers