From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
Jet Chen <jet.chen@intel.com>, Su Tao <tao.su@intel.com>,
Yuanhan Liu <yuanhan.liu@intel.com>, LKP <lkp@01.org>,
linux-kernel@vger.kernel.org
Subject: Re: [trace events] WARNING: CPU: 0 PID: 91 at kernel/sched/core.c:7253 __might_sleep()
Date: Wed, 8 Oct 2014 17:48:38 +0200 [thread overview]
Message-ID: <20141008154838.GM10832@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20141008110825.58bdb51d@gandalf.local.home>
On Wed, Oct 08, 2014 at 11:08:25AM -0400, Steven Rostedt wrote:
> > Steve, wth is that thing supposed to do?
> >
> > set_current_state(TASK_INTERRUPTIBLE);
> > while (!kthread_should_stop())
> > schedule();
> >
> > That looks broken alright. It'll revert to a yield() 'spin' loop if it
> > ever gets a wakeup for anything other than the kthread_stop().
> >
> > Did you mean to write something like:
> >
> > set_current_state(TASK_INTERRUPTIBLE);
> > while (!kthread_should_stop()) {
> > schedule();
> > set_current_state(TASK_INTERRUPTIBLE);
> > }
> > __set_current_state(TASK_RUNNING);
> >
> > ?
>
> Wow, what a blast from the past. That code hasn't been touched since
> 2009!
>
> Anyway, all that thread did was call test work on each cpu, and then
> waits to be killed. It should only get a single wake up and that should
> be from the kthread_stop() call. IOW, that loop should never be
> executed more than once.
>
> What exactly is the bug here?
The bug is as explained, the loop is wrong and will revert to a yield
'spin' loop after a single wakeup.
The debugging that caught it is that you exit the loop without setting
TASK_RUNNING.
next prev parent reply other threads:[~2014-10-08 15:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20141008100613.GA17869@wfg-t540p.sh.intel.com>
2014-10-08 10:41 ` [trace events] WARNING: CPU: 0 PID: 91 at kernel/sched/core.c:7253 __might_sleep() Peter Zijlstra
2014-10-08 15:08 ` Steven Rostedt
2014-10-08 15:48 ` Peter Zijlstra [this message]
2014-10-08 16:17 ` Steven Rostedt
2014-10-08 16:36 ` Peter Zijlstra
2014-10-08 16:51 ` [PATCH] trace: Robustify wait loop Peter Zijlstra
2014-10-08 17:52 ` Steven Rostedt
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=20141008154838.GM10832@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=fengguang.wu@intel.com \
--cc=jet.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@01.org \
--cc=rostedt@goodmis.org \
--cc=tao.su@intel.com \
--cc=yuanhan.liu@intel.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