All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	Davide Libenzi <davidel@xmailserver.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Roland McGrath <roland@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH] kthread: Enhance kthread_stop to abort interruptible sleeps
Date: Tue, 24 Apr 2007 03:09:24 -0700	[thread overview]
Message-ID: <20070424030924.be44ebfa.akpm@linux-foundation.org> (raw)
In-Reply-To: <m1zm5bmywm.fsf@ebiederm.dsl.xmission.com>

On Fri, 13 Apr 2007 21:13:13 -0600 ebiederm@xmission.com (Eric W. Biederman) wrote:

> This patch reworks kthread_stop so it is more flexible and it causes
> the target kthread to abort interruptible sleeps.  Allowing a larger
> class of kernel threads to use to the kthread API.
> 
> The changes start by defining TIF_KTHREAD_STOP on all architectures.
> TIF_KTHREAD_STOP is a per process flag that I can set from another
> process to indicate that a kernel thread should stop.
> 
> wake_up_process in kthread_stop has been replaced by signal_wake_up
> ensuring that the kernel thread if sleeping is woken up in a timely
> manner and with TIF_SIGNAL_PENDING set, which causes us to break out
> of interruptible sleeps.
> 
> recalc_signal_pending was modified to keep TIF_SIGNAL_PENDING set for
> as long as TIF_KTHREAD_STOP is set.
> 
> Arbitrary paths to do_exit are now allowed.  I have placed a
> completion on the thread stack and pointed vfork_done at it, when the
> mm_release is called from do_exit the completion will be called.
> Since the completion is stored on the stack it is important that
> kthread() now calls do_exit ensuring the stack frame that holds the
> completion is never released, and so that our exit_code is certain to
> make it unchanged all the way to do_exit.
> 
> To allow kthread_stop to read the process exit code when exit_mm wakes
> it up  I have moved the setting of exit_code to the beginning of
> do_exit. 

This patch causes this oops: http://userweb.kernel.org/~akpm/s5000508.jpg
with this config: http://userweb.kernel.org/~akpm/config-x.txt

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	Davide Libenzi <davidel@xmailserver.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Roland McGrath <roland@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org, <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] kthread: Enhance kthread_stop to abort interruptible sleeps
Date: Tue, 24 Apr 2007 03:09:24 -0700	[thread overview]
Message-ID: <20070424030924.be44ebfa.akpm@linux-foundation.org> (raw)
In-Reply-To: <m1zm5bmywm.fsf@ebiederm.dsl.xmission.com>

On Fri, 13 Apr 2007 21:13:13 -0600 ebiederm@xmission.com (Eric W. Biederman) wrote:

> This patch reworks kthread_stop so it is more flexible and it causes
> the target kthread to abort interruptible sleeps.  Allowing a larger
> class of kernel threads to use to the kthread API.
> 
> The changes start by defining TIF_KTHREAD_STOP on all architectures.
> TIF_KTHREAD_STOP is a per process flag that I can set from another
> process to indicate that a kernel thread should stop.
> 
> wake_up_process in kthread_stop has been replaced by signal_wake_up
> ensuring that the kernel thread if sleeping is woken up in a timely
> manner and with TIF_SIGNAL_PENDING set, which causes us to break out
> of interruptible sleeps.
> 
> recalc_signal_pending was modified to keep TIF_SIGNAL_PENDING set for
> as long as TIF_KTHREAD_STOP is set.
> 
> Arbitrary paths to do_exit are now allowed.  I have placed a
> completion on the thread stack and pointed vfork_done at it, when the
> mm_release is called from do_exit the completion will be called.
> Since the completion is stored on the stack it is important that
> kthread() now calls do_exit ensuring the stack frame that holds the
> completion is never released, and so that our exit_code is certain to
> make it unchanged all the way to do_exit.
> 
> To allow kthread_stop to read the process exit code when exit_mm wakes
> it up  I have moved the setting of exit_code to the beginning of
> do_exit. 

This patch causes this oops: http://userweb.kernel.org/~akpm/s5000508.jpg
with this config: http://userweb.kernel.org/~akpm/config-x.txt

  parent reply	other threads:[~2007-04-24 10:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-13 13:02 [PATCH 3/3] make kthread_stop() scalable Oleg Nesterov
2007-04-13 23:44 ` Eric W. Biederman
2007-04-14 18:02   ` Oleg Nesterov
2007-04-14 18:34     ` Eric W. Biederman
2007-04-14 18:50       ` Oleg Nesterov
2007-04-14  3:13 ` [PATCH] kthread: Enhance kthread_stop to abort interruptible sleeps Eric W. Biederman
2007-04-14  3:13   ` Eric W. Biederman
2007-04-14  3:17   ` [PATCH] kthread: Simplify kthread_create Eric W. Biederman
2007-04-14  3:17     ` Eric W. Biederman
2007-04-14 18:35   ` [PATCH] kthread: Enhance kthread_stop to abort interruptible sleeps Oleg Nesterov
2007-04-14 19:04     ` Eric W. Biederman
2007-04-14 19:34       ` Oleg Nesterov
2007-04-24 10:09   ` Andrew Morton [this message]
2007-04-24 10:09     ` Andrew Morton
2007-04-24 10:30     ` Eric W. Biederman
2007-04-24 10:30       ` Eric W. Biederman
2007-04-24 10:42       ` Andrew Morton
2007-04-24 10:42         ` Andrew Morton
2007-04-24 11:11         ` Eric W. Biederman
2007-04-24 11:11           ` Eric W. Biederman
2007-04-24 15:05       ` Oleg Nesterov
2007-04-24 15:53         ` Oleg Nesterov
2007-04-24 17:18           ` Eric W. Biederman
2007-04-24 20:27             ` Oleg Nesterov
2007-04-24 21:19               ` Eric W. Biederman

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=20070424030924.be44ebfa.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rjw@sisk.pl \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    /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.