From: Thomas Gleixner <tglx@linutronix.de>
To: Yong Zhang <yong.zhang0@gmail.com>
Cc: Christophe Huriaux <c.huriaux@gmail.com>,
Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Andreas Mohr <andi@lisas.de>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] genirq: don't sync irq thread if current happen to be the very irq thread
Date: Tue, 22 May 2012 15:50:38 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.02.1205221548010.3231@ionos> (raw)
In-Reply-To: <20120520121926.GA24585@zhy>
On Sun, 20 May 2012, Yong Zhang wrote:
> On Sun, May 20, 2012 at 01:27:31PM +0800, Yong Zhang wrote:
> > --- a/kernel/irq/manage.c
> > +++ b/kernel/irq/manage.c
> > @@ -41,6 +41,7 @@ early_param("threadirqs", setup_forced_irqthreads);
> > void synchronize_irq(unsigned int irq)
> > {
> > struct irq_desc *desc = irq_to_desc(irq);
> > + struct irqaction *action = desc->action;
>
> Bad time for dereferencing *action.
You meant dereferencing *desc :)
> /*
> * We made sure that no hardirq handler is running. Now verify
> * that no threaded handlers are active.
> + * But for theaded irq, we don't sync if current happens to be
> + * the irq thread; otherwise we could deadlock.
> */
> + action = desc->action;
And dereferencing action w/o being protected by desc->lock is buggy.
+ while (action) {
> + if (action->thread && action->thread == current)
> + return;
> + action = action->next;
> + }
> +
Aside of that I really do not like that change. It'll hide real
deadlocks when disable_irq() is called from the interrupt handler.
Also this will not cure all problems of that MMC driver on RT or with
forced threaded interrupts.
Assume that tasklet code runs from the softirq thread so it will
schedule when desc->threads_active > 0. This will trigger a
"scheduling while atomic" warning.
The irq_enable/disable dance in that driver is amazing. I have no time
at the moment to grok the logic behind this, but it bet this can be
done way simpler and less horrible.
Thanks,
tglx
next prev parent reply other threads:[~2012-05-22 13:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 14:07 BUG - "scheduling while atomic" on a irq handler (s3c-mci) Christophe Huriaux
2012-05-09 17:49 ` Uwe Kleine-König
2012-05-10 13:17 ` Christophe Huriaux
2012-05-15 17:38 ` Steven Rostedt
2012-05-20 5:27 ` [PATCH] genirq: don't sync irq thread if current happen to be the very irq thread Yong Zhang
2012-05-20 12:19 ` [PATCH v2] " Yong Zhang
2012-05-22 13:50 ` Thomas Gleixner [this message]
2012-05-23 6:54 ` Yong Zhang
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=alpine.LFD.2.02.1205221548010.3231@ionos \
--to=tglx@linutronix.de \
--cc=andi@lisas.de \
--cc=c.huriaux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=yong.zhang0@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;
as well as URLs for NNTP newsgroup(s).