From: Yong Zhang <yong.zhang0@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
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: Wed, 23 May 2012 14:54:58 +0800 [thread overview]
Message-ID: <20120523065458.GA24852@zhy> (raw)
In-Reply-To: <alpine.LFD.2.02.1205221548010.3231@ionos>
On Tue, May 22, 2012 at 03:50:38PM +0200, Thomas Gleixner wrote:
> 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 :)
Ah, yes :)
>
> > /*
> > * 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.
Yes.
>
> 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.
I'll reconsider this issue and try to find the simpler way.
Thanks,
Yong
prev parent reply other threads:[~2012-05-23 6:55 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
2012-05-23 6:54 ` Yong Zhang [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=20120523065458.GA24852@zhy \
--to=yong.zhang0@gmail.com \
--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=tglx@linutronix.de \
--cc=u.kleine-koenig@pengutronix.de \
/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).