From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Trilok Soni <soni.trilok@gmail.com>, Pavel Machek <pavel@ucw.cz>,
Brian Swetland <swetland@google.com>,
Joonyoung Shim <jy0922.shim@samsung.com>,
m.szyprowski@samsung.com, t.fujak@samsung.com,
kyungmin.park@samsung.com, David Brownell <david-b@pacbell.net>,
Daniel Ribeiro <drwyrm@gmail.com>,
arve@android.com, Barry Song <21cnbao@gmail.com>
Subject: Re: [RFC patch 2/3] genirq: Add buslock support for irq chips on slow busses
Date: Fri, 14 Aug 2009 11:29:35 +0200 [thread overview]
Message-ID: <1250242175.5241.1258.camel@twins> (raw)
In-Reply-To: <20090814091819.GA27687@elte.hu>
On Fri, 2009-08-14 at 11:18 +0200, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@linutronix.de> wrote:
>
> > On Fri, 14 Aug 2009, Peter Zijlstra wrote:
> > > On Thu, 2009-08-13 at 19:40 +0000, Thomas Gleixner wrote:
> > > >
> > > > +/**
> > > > + * disable_slowbus_irq - disable an slowbus irq and wait for completion
> > > > + * @irq: Interrupt to disable
> > > > + *
> > > > + * Disable the selected interrupt line. Enables and Disables are
> > > > + * nested.
> > > > + * This function waits for any pending IRQ handlers for this interrupt
> > > > + * to complete before returning. If you use this function while
> > > > + * holding a resource the IRQ handler may need you will deadlock.
> > > > + *
> > > > + * This function must not be called from IRQ context.
> > > > + */
> > > > +void disable_slowbus_irq(unsigned int irq)
> > > > +{
> > > > + struct irq_desc *desc = irq_to_desc(irq);
> > > > +
> > > > + if (!desc || !desc->chip || !desc->chip->bus_lock)
> > > > + return;
> > > > +
> > > > + desc->chip->bus_lock(irq);
> > > > + disable_irq_nosync(irq);
> > > > + if (desc->action)
> > > > + synchronize_irq(irq);
> > > > + desc->chip->bus_sync_unlock(irq);
> > > > +}
> > > > +EXPORT_SYMBOL(disable_slowbus_irq);
> > >
> > > Should we also not check that desc->chip->bus_lock is not set for the
> > > regular function disable_irq()?
> > >
> > > It seems to me mixing disable_irq() and disable_slowbus_irq()
> > > is a recipe for disaster.
> > >
> > > Same for the other slowbus functions of course.
> >
> > Yeah, that's what I wanted to avoid with the first version, which
> > did the conditional locking and did not require a separate API,
> > but Ingo frowned upon the conditional lock.
>
> Mind posting that version too?
>
> Conditional locking is really nasty but if the only other option is
> nastier there's not much we can do, is there?
Ah what I meant was that we can make the posted version better by adding
BUG_ON(desc && desc->chip && desc->chip->bus_lock);
to disable_irq/enable_irq/free_irq.
next prev parent reply other threads:[~2009-08-14 9:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 19:40 [RFC patch 0/3] Support for irq chips on slow busses (i2c, spi) Thomas Gleixner
2009-08-13 19:40 ` [RFC patch 1/3] genirq: Add oneshot support Thomas Gleixner
2009-08-13 19:40 ` [RFC patch 2/3] genirq: Add buslock support for irq chips on slow busses Thomas Gleixner
2009-08-14 8:50 ` Peter Zijlstra
2009-08-14 9:03 ` Thomas Gleixner
2009-08-14 9:18 ` Ingo Molnar
2009-08-14 9:29 ` Peter Zijlstra [this message]
2009-08-14 9:59 ` Thomas Gleixner
2009-08-14 10:17 ` Pavel Machek
2009-08-14 10:20 ` Thomas Gleixner
2009-08-14 10:30 ` Pavel Machek
2009-08-14 11:20 ` Mark Brown
2009-08-15 9:55 ` Ingo Molnar
2009-08-15 11:37 ` Thomas Gleixner
2009-08-15 14:29 ` Ingo Molnar
2009-08-13 19:40 ` [RFC patch 3/3] genirq: Support nested threaded irq handling Thomas Gleixner
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=1250242175.5241.1258.camel@twins \
--to=peterz@infradead.org \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arve@android.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=david-b@pacbell.net \
--cc=dmitry.torokhov@gmail.com \
--cc=drwyrm@gmail.com \
--cc=jy0922.shim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mingo@elte.hu \
--cc=pavel@ucw.cz \
--cc=soni.trilok@gmail.com \
--cc=swetland@google.com \
--cc=t.fujak@samsung.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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