From: Al Viro <viro@ZenIV.linux.org.uk>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: Chris Zankel <chris@zankel.net>,
linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org,
Marc Gauthier <marc@tensilica.com>
Subject: Re: [PATCH 3/3] xtensa: switch to generic sys_execve()
Date: Wed, 24 Oct 2012 03:41:24 +0100 [thread overview]
Message-ID: <20121024024123.GD2616@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1351043317-21631-4-git-send-email-jcmvbkbc@gmail.com>
On Wed, Oct 24, 2012 at 05:48:37AM +0400, Max Filippov wrote:
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> arch/xtensa/include/asm/syscall.h | 2 +-
> arch/xtensa/include/asm/unistd.h | 1 +
> arch/xtensa/include/uapi/asm/unistd.h | 2 +-
> arch/xtensa/kernel/process.c | 25 -------------------------
> 4 files changed, 3 insertions(+), 27 deletions(-)
All three applied, but there's a couple of things I'd like to have on top
of that. Are you OK with the following incremental?
1) ->{set,clear}_child_tid is set by the caller; no need to set it
in copy_thread().
2) for later work it would be easier if copy_thread() hadn't looked
at regs argument at all; telling kernel_thread(9) from clone(2) can be done
by checking p->flags & PF_KTHREAD and for clone(2) it's always going to get
current_pt_regs().
3) interpretation of zero newsp is probably better off in copy_thread()
as well. Eventually we are going to kill regs argument of do_fork() et.al.
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 58e50ff..9d8f387 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -200,7 +200,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
unsigned long thread_fn_arg,
- struct task_struct * p, struct pt_regs * regs)
+ struct task_struct * p, struct pt_regs *unused)
{
struct pt_regs *childregs = task_pt_regs(p);
@@ -212,10 +212,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
*((int*)childregs - 3) = (unsigned long)childregs;
*((int*)childregs - 4) = 0;
- p->set_child_tid = p->clear_child_tid = NULL;
p->thread.sp = (unsigned long)childregs;
- if (regs) {
+ if (!(p->flags & PF_KTHREAD)) {
+ struct pt_regs *regs = current_pt_regs();
p->thread.ra = MAKE_RA_FOR_CALL(
(unsigned long)ret_from_fork, 0x1);
@@ -224,7 +224,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
* ARs beyond a0-a15 exist past the end of the struct.
*/
*childregs = *regs;
- childregs->areg[1] = usp_thread_fn;
+ if (usp_thread_fn)
+ childregs->areg[1] = usp_thread_fn;
childregs->areg[2] = 0;
if (clone_flags & CLONE_VM) {
@@ -346,7 +347,5 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
void __user *child_tid, long a5,
struct pt_regs *regs)
{
- if (!newsp)
- newsp = regs->areg[1];
return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
}
next prev parent reply other threads:[~2012-10-24 2:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-24 1:48 [PATCH 0/3] xtensa: conversion to generic kernel_thread and friends Max Filippov
2012-10-24 1:48 ` [PATCH 1/3] xtensa: switch to generic kernel_thread() Max Filippov
2012-10-24 1:48 ` [PATCH 2/3] xtensa: switch to generic kernel_execve() Max Filippov
2012-10-24 1:48 ` [PATCH 3/3] xtensa: switch to generic sys_execve() Max Filippov
2012-10-24 2:41 ` Al Viro [this message]
2012-10-24 9:16 ` Max Filippov
2012-10-24 14:01 ` Al Viro
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=20121024024123.GD2616@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=chris@zankel.net \
--cc=jcmvbkbc@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=marc@tensilica.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).