All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Greg Ungerer <gregungerer@westnet.com.au>
Cc: Mark Salter <msalter@redhat.com>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [RFC] status of execve() work - per-architecture patches solicited
Date: Sun, 23 Sep 2012 01:46:36 +0100	[thread overview]
Message-ID: <20120923004636.GL13973@ZenIV.linux.org.uk> (raw)
In-Reply-To: <505D9DFB.8080002@westnet.com.au>

On Sat, Sep 22, 2012 at 09:16:11PM +1000, Greg Ungerer wrote:
> I sent the patch to the m68k-linux list. Its been acked by Geert.
> 
>  http://marc.info/?l=linux-m68k&m=134742688015639&w=2
> 
> I was going to push it through the m68knommu git tree, but I don't mind
> if you would rather take it with your changes.

Applied.  Other changes since the last update:
	* ppc breakage debugged and fixed
	* kernel_thread() unified on all converted architectures.
An architecture can add select GENERIC_KERNEL_THREAD to its Kconfig
if it's ready to handle that in its copy_thread() - regs will be
NULL, usp - (unsigned long)fn, stck_size - (unsigned long)arg.  It
should set things up for ret_from_kernel_thread, so that the sucker
would call given function on given argument.  See what e.g. m68k
does in #experimental-kernel_thread() in its copy_thread() and
ret_from_kernel_thread; it's a fairly typical situation if you have
enough callee-saved registers to play with.  If not, put these
values somewhere in childregs and pick them in ret_from_kernel_thread -
see i386 for example of that.

Eventually I hope to merge all kernel_thread() instances; then
CONFIG_GENERIC_KERNEL_THREAD will be gone.  Note, BTW, that having
killed all in-kernel syscalls-via-trap on given architecture we
get a chance to optimize the syscall glue; for instance, on ppc64
we could just go ahead and set stack pointer from %r13->kstack
unconditionally, rather than playing with "if we are coming from
the kernel mode, push stack pointer down by INT_FRAME_SIZE, otherwise
pick it from per-CPU data structure pointed to by r13" as we do now.
And that's just the most obvious bit in the very beginning of their
system_call_common; there's more.  I haven't touched that stuff -
this kind of work belongs in architecture trees, not in this series.

FWIW, if we do that conversion for all kernel_thread(), we get another
nice thing pretty much for free - do_fork() won't need pt_regs passed
to it anymore.  Note that after that we have two possible values passed
there - NULL (for kernel_thread()) and current_pt_regs() (from sys_fork()
and friends).  I.e. it's 1 bit of information, *and* we already have
that bit - it's current->flags & PF_KTHREAD (it's actually a bit more
convenient to check its copy in p->flags).  Only kernel threads call
kernel_thread(); only userland processes call sys_fork/sys_clone/sys_vfork().
IOW, all architectures are converted to generic kernel_thread() implementation,
we can
	* stop passing pt_regs to do_fork()
	* stop passing pt_regs to copy_process()
	* stop passing pt_regs to copy_thread() - it can bloody well be
calculated there.  And it's not used until that point.

  reply	other threads:[~2012-09-23  0:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 18:20 [RFC] status of execve() work - per-architecture patches solicited Al Viro
2012-09-07 18:22 ` Al Viro
2012-09-10 13:40 ` Greg Ungerer
2012-09-10 16:49   ` Al Viro
2012-09-11  3:39     ` Greg Ungerer
2012-09-13 13:27     ` Greg Ungerer
2012-09-13 13:27       ` Greg Ungerer
2012-09-10 22:20 ` Mark Salter
2012-09-10 22:20   ` [PATCH 1/2] c6x: implement ret_from_kernel_execve() and switch to generic kernel_execve() Mark Salter
2012-09-10 22:20   ` [PATCH 2/2] c6x: switch to generic sys_execve() Mark Salter
2012-09-17  3:26   ` [RFC] status of execve() work - per-architecture patches solicited Al Viro
2012-09-21 16:26     ` Mark Salter
2012-09-21 16:26       ` [PATCH 1/3] c6x: add ret_from_kernel_thread(), simplify kernel_thread() Mark Salter
2012-09-21 16:26       ` [PATCH 2/3] c6x: switch to generic kernel_execve Mark Salter
2012-09-21 16:26       ` [PATCH 3/3] c6x: switch to generic sys_execve Mark Salter
2012-09-21 18:39       ` [RFC] status of execve() work - per-architecture patches solicited Al Viro
2012-09-22 11:16         ` Greg Ungerer
2012-09-23  0:46           ` Al Viro [this message]
2012-09-24 10:59             ` Vineet Gupta
2012-09-24 10:59               ` Vineet Gupta
2012-09-17  9:29 ` Michal Simek
2012-09-17 22:57   ` Al Viro
2012-09-19 12:20 ` Vineet Gupta
2012-09-19 12:20   ` Vineet Gupta
2012-09-19 13:32   ` 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=20120923004636.GL13973@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=gregungerer@westnet.com.au \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msalter@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.