From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Murali K. Vemuri" <vemuri.muralikrishna@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: worker thread - filp_close() problem
Date: Wed, 9 Nov 2011 10:12:58 -0800 [thread overview]
Message-ID: <20111109181257.GA26633@core.coreip.homeip.net> (raw)
In-Reply-To: <CAME+iuf1xWb=oJkaP9Dm0G2Tbrx_TUGD+DJ58mNfROeovE3+sQ@mail.gmail.com>
On Wed, Nov 09, 2011 at 08:52:12PM +0900, Murali K. Vemuri wrote:
> Hi there,
>
> I have a device driver where in I have to do like this:
>
> (I am using Kernel 2.6.32, and unfortunately cannot upgrade).
>
> 1. Register for an interrupt.
> 2. When I receive the interrupt, I do some processing, and schedule a
> worker for further processing after 25 msec.
> (The device data sheet says I have to give a minimum of 20 m sec).
> 3. The worker thread has to do some processing and then program
> another device connected to the serial port.
>
> Problem:
> 1. as long as I don't call the program_serial_dev() from
> my_dev_task(), everything is fine.
> 2. When I call the program_serial_dev(), I am, getting the error
> (console freezes as well):
> ------------[ cut here ]------------
> WARNING: at kernel/workqueue.c:485 flush_cpu_workqueue+0x34/0x88()
> [<c003f92c>] (unwind_backtrace+0x0/0xd8) from [<c006404c>]
> (warn_slowpath_common+0x48/0x60)
It looks like we end up trying to flush a workqueue from within a work
item, which deadlocks.
Since you are using threaded IRQ just stick msleep(25) there and call
program_serial_dev() from it.
... But from the looks of things the programming should not be done in
kernel but rather from userspace...
--
Dmitry
prev parent reply other threads:[~2011-11-09 18:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 11:52 Murali K. Vemuri
2011-11-09 18:12 ` Dmitry Torokhov [this message]
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=20111109181257.GA26633@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vemuri.muralikrishna@gmail.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
all inboxes | Powered by JetHome®