From: Thomas Gleixner <tglx@linutronix.de>
To: Chen Gang <gang.chen@asianux.com>
Cc: Tejun Heo <tj@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
laijs@cn.fujitsu.com, Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/kthread.c: need spin_lock_irq() for 'worker' before main looping, since it can "WARN_ON(worker->task)".
Date: Thu, 20 Jun 2013 09:02:49 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1306200900030.4013@ionos.tec.linutronix.de> (raw)
In-Reply-To: <51C26087.9000109@asianux.com>
On Thu, 20 Jun 2013, Chen Gang wrote:
> On 06/19/2013 11:52 PM, Tejun Heo wrote:
> > On Wed, Jun 19, 2013 at 06:17:36PM +0800, Chen Gang wrote:
> >> > Hmm... can 'worker->task' has chance to be not NULL before set 'current'
> >> > to it ?
> > Yes, if the caller screws up and try to attach more than one workers
> > to the kthread_worker, which has some possibility of happening as
> > kthread_worker allows both attaching and detaching a worker.
> >
>
> If we detect the bugs, and still want to use WARN_ON() to report warning
> and continue running, we need be sure of keeping the related things no
> touch (at least not lead to worse).
>
> If we can not be sure of keeping the related things no touch:
> if it is a kernel bug, better use BUG_ON() instead of,
> if it is a user mode bug, better to return failure with error code and
> print related information.
Wrong. BUG_ON() is only for cases where the kernel CANNOT continue at
all. WARN_ON() prints the very same information, but allows to
continue.
> BUG_ON() will stop current working flow and report kernel bug in details.
There is no reason to crash the machine completely. The kernel can
continue and the WARN_ON reports the bug with the same details.
Thanks,
tglx
next prev parent reply other threads:[~2013-06-20 7:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 4:03 Chen Gang
2013-06-19 8:41 ` Tejun Heo
2013-06-19 10:17 ` Chen Gang
2013-06-19 15:52 ` Tejun Heo
2013-06-20 1:53 ` Chen Gang
2013-06-20 7:02 ` Thomas Gleixner [this message]
2013-06-20 7:37 ` Chen Gang
2013-06-20 8:28 ` Thomas Gleixner
2013-06-20 9:36 ` Chen Gang
2013-06-19 8:43 ` Thomas Gleixner
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=alpine.DEB.2.02.1306200900030.4013@ionos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=gang.chen@asianux.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®