mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, mingo@elte.hu,
	peterz@infradead.org, rostedt@goodmis.org,
	jonathan@jonmasters.org
Subject: Re: [patch 4/4] genirq: add support for threaded interrupt handlers
Date: Thu, 26 Feb 2009 21:27:52 -0800	[thread overview]
Message-ID: <20090226212752.332ba546@infradead.org> (raw)
In-Reply-To: <20090226153216.5db66bc3.akpm@linux-foundation.org>

On Thu, 26 Feb 2009 15:32:16 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Thu, 26 Feb 2009 13:28:23 -0000
> Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> > Add suppport for threaded interrupt handlers. This is a more strict
> > separation of the primary interrupt handler, which runs in hard
> > interrupt context, and the real interrupt handler, which handles the
> > real device functionality, than the existing hardirq/softirq
> > separation.
> > 
> > The primary hard interrupt context handler solely checks whether the
> > interrupt originates from the device or not. In case the interrupt
> > is asserted by the device the handler disables the interrupt on the
> > device level. This must be the only functionality of the primary
> > handler and this restriction has to be carefully monitored to avoid
> > unresolvable locking scenarios with a fully preemptible kernel.
> > 
> > The threaded handler allows to integrate hardware related
> > functionality and softirq/tasklet functions in the handler
> > thread.
> > 
> 
> A typical device driver will do:
> 
> some_function(...)
> {
> 	spin_lock_irqsave(&dev->lock);
> }
> 
> irq_handler(...)
> {
> 	spin_lock(&dev->lock);
> }
> 
> and this does not deadlock, because the driver "knows" that the IRQ is
> disabled during the execution of the IRQ handler.
> 
> But how is this optimisation supported with IRQ threads?  Do we leave
> the IRQ disabled during the thread execution?  Or does the driver need
> to be changed?
> 
> Bearing in mind that the driver might choose to split the IRQ handling
> between hard-irq context fastpath and process-context slowpath (I
> hope), and that each path might want to take the same lock.
> 


Realistically, for the "we go threaded interrupts" case (which is
opt-in), I think the only sane option is
* the quickhandler runs with irqs off
* the "slow" threaded handler runs with irqs on
And we guarantee both of these conditions from the core, to the point
that I think we should not allow any other combination.

This also should be fine for basically all cases; the quick handler
really needs to be quick so irq off makes sense, and the slow handler
can, worst case, turn off interrupts by itself, but normally is
preemptable etc etc.


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

  reply	other threads:[~2009-02-27  5:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26 13:28 [patch 0/4] genirq: add infrastructure for threaded interrupt handlers V2 Thomas Gleixner
2009-02-26 13:28 ` [patch 1/4] genirq: make irqreturn_t an enum Thomas Gleixner
2009-03-25 19:51   ` Geert Uytterhoeven
2009-02-26 13:28 ` [patch 2/4] genirq: use kzalloc instead of explicit zero initialization Thomas Gleixner
2009-02-26 13:28 ` [patch 3/4] genirq: add a quick check handler Thomas Gleixner
2009-02-26 23:03   ` Andrew Morton
2009-02-26 23:11     ` Thomas Gleixner
2009-02-28 22:24   ` Christoph Hellwig
2009-03-01  9:44     ` Thomas Gleixner
2009-03-05 19:59     ` Sven-Thorsten Dietrich
2009-03-17  7:54       ` Christoph Hellwig
2009-03-17 15:29         ` Steven Rostedt
2009-02-26 13:28 ` [patch 4/4] genirq: add support for threaded interrupt handlers Thomas Gleixner
2009-02-26 23:32   ` Andrew Morton
2009-02-27  5:27     ` Arjan van de Ven [this message]
2009-02-27  5:45       ` Andrew Morton
2009-02-27  7:18         ` Peter Zijlstra
2009-02-27  7:48           ` Andrew Morton
2009-02-27  8:05             ` Peter Zijlstra
2009-02-27  8:15               ` Andrew Morton
2009-02-27 15:06               ` Arjan van de Ven
2009-02-27 15:30                 ` Steven Rostedt
2009-02-28 13:46                   ` Stefan Richter
2009-03-02 13:21                     ` Peter Zijlstra
2009-02-28 17:13             ` Andi Kleen
2009-02-27 16:43     ` Thomas Gleixner
2009-02-26 15:26 ` [patch 0/4] genirq: add infrastructure for threaded interrupt handlers V2 Jon Masters
2009-03-05 20:03   ` Sven-Thorsten Dietrich
2009-02-28 22:10 ` Christoph Hellwig
2009-03-01  9:43   ` Thomas Gleixner
2009-03-05  8:40 ` [ANNOUNCE] USB genirq " Sven-Thorsten Dietrich

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=20090226212752.332ba546@infradead.org \
    --to=arjan@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=jonathan@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.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

all inboxes | Powered by JetHome®