linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Dowad <alexinbeijing@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	Matt Fleming <matt.fleming@intel.com>,
	"open list:IA64 (Itanium) PL..." <linux-ia64@vger.kernel.org>
Subject: Re: [PATCH 13/32] ia64: copy_thread(): rename 'user_stack_size' argument to 'kthread_arg'
Date: Sat, 14 Mar 2015 19:54:17 +0200	[thread overview]
Message-ID: <550475C9.8000107@gmail.com> (raw)
In-Reply-To: <1426270496-26362-3-git-send-email-alexinbeijing@gmail.com>

Sorry, this patch was in error. (I learned about the IA64-only clone2 
syscall too late.)

Please disregard. Thanks! Alex Dowad

On 13/03/15 20:14, Alex Dowad wrote:
> '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 <alexinbeijing@gmail.com>
> ---
>   arch/ia64/kernel/process.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
> index b515149..d4a78da 100644
> --- a/arch/ia64/kernel/process.c
> +++ b/arch/ia64/kernel/process.c
> @@ -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;


  reply	other threads:[~2015-03-14 17:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 18:14 [PATCH 11/32] frv: copy_thread(): rename 'arg' argument to 'kthread_arg' Alex Dowad
2015-03-13 18:14 ` [PATCH 12/32] hexagon: " Alex Dowad
2015-03-16 16:25   ` rkuo
2015-03-13 18:14 ` [PATCH 13/32] ia64: copy_thread(): rename 'user_stack_size' " Alex Dowad
2015-03-14 17:54   ` Alex Dowad [this message]
2015-03-13 18:14 ` [PATCH 14/32] m32r: copy_thread(): rename 'arg' " Alex Dowad
2015-03-13 18:14 ` [PATCH 15/32] m68k: " Alex Dowad
2015-03-13 18:14 ` [PATCH 16/32] metag: " Alex Dowad
2015-03-16 11:39   ` James Hogan
2015-03-16 13:13     ` [PATCHv2 " Alex Dowad
2015-03-16 14:31       ` James Hogan
2015-03-16 14:38         ` Alex Dowad
2015-03-16 14:38         ` [PATCHv3 " Alex Dowad
2015-03-16 14:52           ` James Hogan
2015-03-13 18:14 ` [PATCH 17/32] microblaze: " Alex Dowad
2015-03-13 18:14 ` [PATCH 18/32] mips: " Alex Dowad
2015-03-13 18:14 ` [PATCH 19/32] mn10300: copy_thread(): rename 'ustk_size' " Alex Dowad
2015-03-13 18:14 ` [PATCH 20/32] nios2: copy_thread(): rename 'arg' " Alex Dowad
2015-03-13 18:14 ` [PATCH 21/32] openrisc: " Alex Dowad
2015-03-13 18:14 ` [PATCH 22/32] parisc: " Alex Dowad
2015-03-13 18:14 ` [PATCH 23/32] powerpc: " Alex Dowad
2015-03-19  6:45   ` [23/32] " Michael Ellerman
2015-03-19  7:22     ` Alex Dowad
2015-03-19 23:54       ` Michael Ellerman
2015-03-24 19:49         ` Alex Dowad
2015-03-25  1:35           ` Michael Ellerman
2015-03-13 18:14 ` [PATCH 24/32] s390: " Alex Dowad
2015-03-13 18:14 ` [PATCH 25/32] score: " Alex Dowad
2015-03-13 18:14 ` [PATCH 26/32] sh: " Alex Dowad
2015-03-13 18:14 ` [PATCH 27/32] sparc: " Alex Dowad
2015-03-13 18:14 ` [PATCH 28/32] tile: " Alex Dowad
2015-03-16 20:19   ` Chris Metcalf
2015-03-16 20:44     ` Alex Dowad
2015-03-19 18:06       ` Chris Metcalf
2015-03-13 18:14 ` [PATCH 29/32] um: " Alex Dowad
2015-03-13 18:14 ` [PATCH 30/32] unicore32: copy_thread(): rename 'stk_sz' " Alex Dowad
2015-03-13 18:14 ` [PATCH 31/32] x86: copy_thread(): rename 'arg' " Alex Dowad
2015-03-13 18:14 ` [PATCH 32/32] xtensa: " Alex Dowad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550475C9.8000107@gmail.com \
    --to=alexinbeijing@gmail.com \
    --cc=cl@linux.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=tj@kernel.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).