From: Brian Norris <briannorris@chromium.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>,
Brian Norris <computersforpeace@gmail.com>
Subject: Re: iio: WARNING at kernel/sched/core.c:7630: do not call blocking ops when !TASK_RUNNING
Date: Tue, 2 Aug 2016 09:57:33 -0700 [thread overview]
Message-ID: <20160802165732.GA3310@localhost> (raw)
In-Reply-To: <37ea974c-9ac6-5a40-0f0e-ee34ef605a08@metafoo.de>
Hi Lars,
On Tue, Aug 02, 2016 at 03:06:39PM +0200, Lars-Peter Clausen wrote:
> On 08/02/2016 03:12 AM, Brian Norris wrote:
> > I'm seeing the following warnings when I read from an IIO char device,
> > with CONFIG_DEBUG_ATOMIC_SLEEP=y. I'm testing a v4.4 kernel, but AFAICT,
> > nothing too relevant has changed between that and v4.7:
> [...]
> > Have any of you seen this kind of issue before (perhaps most IIO users
> > are not using CONFIG_DEBUG_ATOMIC_SLEEP)? If the WARNING is really
> > correct, then this problem has really been around a while. It looks like
> > we have a wait_event_interruptible() called, with this call chain in the
> > 'condition' path:
> >
> > iio_buffer_ready()
> > -> iio_buffer_data_available() (i.e., iio_kfifo_buf_data_available())
> > -> mutex_lock()
> >
> > Calling mutex_lock() means we clobber the TASK_INTERRUPTIBLE state with
> > TASK_RUNNING -- hence, the WARNING. Should this be using a spinlock
> > instead? Or is there some way to refactor this to avoid calling these
> > sleeping functions in the wait_event*() condition?
>
> Hi,
>
> Yes, this is an issue, thanks for pointing this out. It has been there for a
> while, my fault, sorry for that. We need a solution like pointed out in this
> article (https://lwn.net/Articles/628628/).
Ah, thanks for the pointer. I thought this problem seemed familiar, but
I couldn't find a canonical solution. The wait_woken() solution looks
like a good starting point, although it's definitely got more
boilerplate... It also requires a 'timeout'; I guess we'd want
MAX_SCHEDULE_TIMEOUT for this case?
Do you want to cook a patch, or should I?
Brian
next prev parent reply other threads:[~2016-08-02 16:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 1:12 iio: WARNING at kernel/sched/core.c:7630: do not call blocking ops when !TASK_RUNNING Brian Norris
2016-08-02 13:06 ` Lars-Peter Clausen
2016-08-02 16:57 ` Brian Norris [this message]
2016-08-02 17:04 ` Lars-Peter Clausen
2016-08-04 8:26 ` [PATCH] iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING" Brian Norris
2016-08-04 8:45 ` Lars-Peter Clausen
2016-08-04 9:41 ` Brian Norris
2016-08-04 10:21 ` Lars-Peter Clausen
2016-08-08 22:23 ` Brian Norris
2016-08-09 8:22 ` Lars-Peter Clausen
2016-08-09 0:19 ` [PATCH v2] " Brian Norris
2016-08-15 15:54 ` Jonathan Cameron
2016-08-16 15:27 ` Lars-Peter Clausen
2016-08-21 11:21 ` Jonathan Cameron
2016-08-21 12:26 ` Lars-Peter Clausen
2016-08-21 15:23 ` Jonathan Cameron
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=20160802165732.GA3310@localhost \
--to=briannorris@chromium.org \
--cc=computersforpeace@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=pmeerw@pmeerw.net \
/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.