Re: lockdep and threaded IRQs (was: ...)

From: David Brownell
Date: Fri Feb 27 2009 - 23:47:12 EST


On Friday 27 February 2009, Andrew Morton wrote:
> On Fri, 27 Feb 2009 18:30:36 -0800 David Brownell <david-b@xxxxxxxxxxx> wrote:
>
> > > ah, OK, twl4030_i2c_read_u8() does i2c I/O.
> > >
> > > Can't do that.
> >
> > Threaded IRQ handlers *can* do that. That's the point.
> >
> > Now, if you were to say "keep waiting a few more years
> > until some threaded IRQ framework finally merges" ...
> > the question comes up, "What to do in the meanwhile".
> > (Ditto, "well, we've been waiting a long time now to
> > see those threaded IRQs, what's up with them?")
>
> I don't have a clue what you're talking about. Where is this "threaded
> irq handler" implementation of which you speak? File and line?

You quoted the entirety of the *handler* a few messages ago
in this thread, where you asked the question which you
answer "ah, OK..." above.

Now, where is that being set up as being threaded? I
referenced that a message or two earlier:

drivers/mfd/twl4030-irq.c

Where you'll observe twl_init_irq() at line 688 setting
up the thread and the Primary IRQ Handler (PIH) dispatch.
That's pretty much bog-standard chained IRQ setup code,
except that it chains through a thread.

When an IRQ comes in, handle_twl4030_pih() acks and masks
that top level IRQ. Then it wakes twl4030_irq_thread(),
which issues I2C operations to read the IRQ status from
the chip ... first PIH to find out which SIH modules are
raising an IRQ, then SIH to dispatch that status. Then
handle_irq() from that thread to invoke the handler in
that thread context; it will issue more I2C ops.

And the lockdep thing kicks in through handle_irq(),
where the IRQ handler wrongly gets invoked with the
IRQs disabled -- iff lockdep is enabled. Otherwise,
that IRQ thread is just like any other thread.

- Dave


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/