From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Paul Fertser <fercerpav@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
sameo@linux.intel.com, linux-kernel@vger.kernel.org,
Anton Vorontsov <cbou@mail.ru>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] pcf50633: use a dedicated workqueue for irq processing
Date: Tue, 18 Aug 2009 17:29:28 +0400 [thread overview]
Message-ID: <20090818132928.GA32765@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090731092313.GA21633@home.pavel.comp>
On Fri, Jul 31, 2009 at 01:23:13PM +0400, Paul Fertser wrote:
> On Thu, Jul 30, 2009 at 03:34:25PM -0700, Andrew Morton wrote:
> > On Tue, 28 Jul 2009 00:41:15 +0400
> > Paul Fertser <fercerpav@gmail.com> wrote:
> >
> > > Using the default kernel "events" workqueue causes problems with
> > > synchronous adc readings if initiated from some task on the same
> > > workqueue.
> > >
> > > I had a deadlock trying to use pcf50633_adc_sync_read from a
> > > power_supply class driver because the reading was initiated from the
> > > workqueue and it waited for the irq processing to complete (to get the
> > > result) and that was put on the same workqueue.
> >
> > I don't get it.
> >
> > Do you meant that pcf50633_adc_sync_read() was called via a
> > schedule_work() handler? If so, wasn't that a bug?
>
> Andrew, i think it is called this way:
>
> power_supply_changed -> schedule_work(&psy->changed_work) ->
> power_supply_changed_work -> kobject_uevent(&psy->dev->kobj, KOBJ_CHANGE)
> -> power_supply_uevent -> power_supply_show_property -> get_property ->
> bat->pdata->get_voltage -> pcf50633_adc_sync_read
>
> I assumed that since power_supply class is well-established and widely used
> that's an intended behaviour. CCing relevant maintainers to get their
> opinions.
The thing is that power_supply_changed() is supposed to be callable
from any context (including hard IRQs), so we use schedule_work().
I see the deadlock problem, and it could be fixed by a dedicated
workqueue either in the pcf50633 driver, or power supply class.
I don't mind either way.
Another option is to implement power_supply_changed_can_sleep(),
which won't use schedule_work(), and so we won't need another
thread.
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2009-08-18 13:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-27 20:41 [PATCH] pcf50633: use a dedicated workqueue for irq processing Paul Fertser
2009-07-30 22:34 ` Andrew Morton
2009-07-31 9:23 ` Paul Fertser
2009-08-18 13:29 ` Anton Vorontsov [this message]
2009-07-31 10:45 ` Mark Brown
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=20090818132928.GA32765@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=akpm@linux-foundation.org \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=fercerpav@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.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