[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1306200900030.4013@ionos.tec.linutronix.de>
Date: Thu, 20 Jun 2013 09:02:49 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Chen Gang <gang.chen@...anux.com>
cc: Tejun Heo <tj@...nel.org>, Oleg Nesterov <oleg@...hat.com>,
laijs@...fujitsu.com, Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/kthread.c: need spin_lock_irq() for 'worker'
before main looping, since it can "WARN_ON(worker->task)".
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists