Re: [PATCH] powerpc - Initialize the irq radix tree earlier

From: Sebastien Dugue
Date: Thu Jul 31 2008 - 09:25:47 EST


On Thu, 31 Jul 2008 23:01:39 +1000 Michael Ellerman <michael@xxxxxxxxxxxxxx> wrote:

> On Thu, 2008-07-31 at 22:58 +1000, Michael Ellerman wrote:
> > On Thu, 2008-07-31 at 14:00 +0200, Sebastien Dugue wrote:
> > > On Thu, 31 Jul 2008 21:40:56 +1000 Michael Ellerman <michael@xxxxxxxxxxxxxx> wrote:
> > > >
> > > > This boot ordering stuff is pretty hairy, so I might have missed
> > > > something, but this is how the code is ordered AFAICT:
> > > > ï
> > > > start_kernel()
> > > > init_IRQ()
> > > > ...
> > > > local_irq_enable()
> > > > ...
> > > > rest_init()
> > > > kernel_thread()
> > > > kernel_init()
> > > > smp_prepare_cpus()
> > > > smp_xics_probe() (via smp_ops->probe())
> > > >
> > > >
> > > > What's stopping us from taking an irq between local_irq_enable() and
> > > > smp_xics_probe() ? Is it just that no one's request_irq()'ed them yet?
> > >
> > > It's hairy, I agree, but as you've mentioned no one has done a request_irq()
> > > at that point. The first one to do it is smp_xics_probe() for the IPI.
> >
> > Hmm, I don't think that's strong enough. I can trivially cause irqs to
> > fire during a kexec reboot just by mashing the keyboard.
> >
> > And during a kdump boot all sorts of stuff could be firing. Even during
> > a clean boot, from firmware, I don't think we can guarantee that
> > nothing's going to fire.
> >
> > .. after a bit of testing ..
> >
> > It seems it actually works (sort of).
> >
> > xics_remap_irq() calls irq_radix_revmap_lookup(), which calls:
> >
> > ptr = radix_tree_lookup(&host->revmap_data.tree, hwirq);
> >
> > And because ïhost->revmap_data.tree was zalloc'ed we trip on the first
> > check here:
>
> @#$% ctrl-enter == send!
>
> Continuing ...
>
> void *radix_tree_lookup(struct radix_tree_root *root, unsigned long index)
> {
> unsigned int height, shift;
> struct radix_tree_node *node, **slot;
>
> node = rcu_dereference(root->rnode);
> if (node == NULL)
> return NULL;
>
> Which means ïirq_radix_revmap_lookup() will return NO_IRQ, which is cool.

Which is what I intended so that as long as no IRQ is registered we
return NO_IRQ.

>
>
> So I think it can fly, as long as we're happy that we can't reverse map
> anything until smp_xics_probe() - and I think that's true, as any irq we
> take will be invalid.

That's true as no IRQs are registered before smp_xics_probe() and for any
interrupt we might get before that, irq_radix_revmap_lookup() will return
NO_IRQ.

Thanks,

Sebastien.
--
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/