From: Ingo Molnar <mingo@elte.hu>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Pavel Machek <pavel@ucw.cz>, LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Trilok Soni <soni.trilok@gmail.com>,
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: Sat, 15 Aug 2009 16:29:25 +0200 [thread overview]
Message-ID: <20090815142925.GA12298@elte.hu> (raw)
In-Reply-To: <alpine.LFD.2.00.0908151213350.1283@localhost.localdomain>
* Thomas Gleixner <tglx@linutronix.de> wrote:
> On Sat, 15 Aug 2009, Ingo Molnar wrote:
> > * Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> >
> > > On Fri, Aug 14, 2009 at 12:20:49PM +0200, Thomas Gleixner wrote:
> > > > On Fri, 14 Aug 2009, Pavel Machek wrote:
> > >
> > > > > AFAICT this means that driver would need to know what kind of IRQ it
> > > > > is hooked to, right? That will lead to some ugly code in drivers that
> > > > > can handle both normal and slowbus irqs, right?
> > >
> > > > Are there such drivers in reality ?
> > >
> > > Yes. The GPIO based stuff is the prime example but there's other
> > > examples - one is the WM831x touchscreen (no driver in mainline
> > > yet) which can use interrupts via the main interrupt controller on
> > > the CPU but also has the option of bringing the interrupt signals
> > > out to dedicated pins on the chip for direct connection to the CPU
> > > precisely to avoid the overheads of these slow interrupt
> > > controllers.
> >
> > This would call for Thomas's first version of the patch, that is
> > transparent to drivers - the IRQ subsystem will know how to lock
> > access to the line.
> >
> > How about implementing that first patch in a cleaner way - can we
> > somehow express the slow-bus property purely via the irqchip? Or is
> > that too lowlevel?
>
> The problem here is that the management functions serialize via
> irqdesc->lock and call the chip level function with the lock held
> (preemption and interrupts disabled). So we can not access the
> slow bus chips from these low level functions.
>
> If the low level functions just store the information and schedule
> it for bus access then there is no serialization anymore. Lets
> look at disable_irq():
>
> spin_lock_irqsave(&desc->lock);
> ....
> desc->chip->mask();
> schedule bus access;
> ...
> spin_lock_irqsave(&desc->lock);
>
> So now we return, but the mask has not reached the chip.
>
> The idea of bus_lock/bus_sync_unlock() was to provide well defined
> synchronization points for the chip level implementation to do the bus
> update and have this serialized against other management functions.
>
> desc->chip->bus_lock();
> Take the chip->bus mutex
>
> spin_lock_irqsave(&desc->lock);
> ....
> desc->chip->mask();
> store mask information
> ...
> spin_lock_irqsave(&desc->lock);
>
> desc->chip->bus_sync_unlock();
> Update the mask via the slow bus
> Release chip->bus mutex
>
> That way we have made sure that the change to the chip actually
> hits the hardware before we allow further management operations
> and it simplifies the code for the chip implementation as the bus
> access can be done in the context of the caller w/o the need of an
> extra thread/workqueue ...
Given the alternatives i'd prefer this one now ...
Ingo
next prev parent reply other threads:[~2009-08-15 14:29 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
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 [this message]
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=20090815142925.GA12298@elte.hu \
--to=mingo@elte.hu \
--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=pavel@ucw.cz \
--cc=peterz@infradead.org \
--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