From: victorascroft@gmail.com (Victor Ascroft)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Query on workqueue
Date: Tue, 13 Jan 2015 19:21:40 +0530 [thread overview]
Message-ID: <54B522EC.6080601@gmail.com> (raw)
Hello,
Is it ok to use wait_for_completion in a workqueue?
static void my_work(struct work_struct *work)
{
while (true)
{
wait_for_completion(completion);
// Do something here
reinit_completion(completion);
enable_irq(irq);
}
}
static irqreturn_t my_irq_handler(int irq, void *dev)
{
disable_irq(irq);
complete(completion);
return IRQ_HANDLED;
}
Something like the above is what I have. Is it a correct way to
do things or complete idiotic brainfart. Workqueues can sleep so
I thought of the above code, but, was not sure.
And I am not using _interruptible or _interruptible_timeout because
I absolutely want it to wait for the IRQ. Now as such though this
works I get stack traces with hung task complaining and I have
to set /proc/sys/kernel/hung_task_timeout_secs to 0. And were the IRQ
not generated I do get NMI watchdog hang.
I will accept I have only little knowledge of these things.
Regards,
Victor.
next reply other threads:[~2015-01-13 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 13:51 Victor Ascroft [this message]
2015-01-13 15:31 ` Query on workqueue Dave Tian
2015-01-13 17:21 ` Richard Maciel Costa
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=54B522EC.6080601@gmail.com \
--to=victorascroft@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/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;
as well as URLs for NNTP newsgroup(s).