Re: [PATCH] sparse_irq aka dyn_irq v13

From: Andrew Morton
Date: Thu Nov 13 2008 - 17:16:18 EST


On Thu, 13 Nov 2008 14:01:06 -0800
"Yinghai Lu" <yinghai@xxxxxxxxxx> wrote:

> On Thu, Nov 13, 2008 at 1:18 PM, Andrew Morton
> <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, 13 Nov 2008 12:16:56 -0800
> > Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> >
> >> From: Yinghai Lu <yinghai@xxxxxxxxxx>
> >> Subject: sparseirq v13
> >
> > My overall view on this is that it takes some of the kernel's most
> > fragile and most problem-dense code and makes it much more complex, and
> > by adding new configuration options it significantly worsens our
> > testing coverage.
> >
> > The patch is HHHHHUUUUUUUUUUGGGGGEEE! Did it really need to be a
> > single megapatch?
> >
> > Other architectures want (or have) sparse interrupts. Are those guys
> > paying attention here?
> >
> > I don't have a clue what all this does. I hope those who will work on
> > this code are sufficiently familiar with it all to be able to maintain
> > it when there are close to zero comments in some of our most tricky and
> > problem-prone code.
> >
>
> ...
>
> >> +static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS];
> >
> > Do these need to be 32-bit? Maybe they'll fit in 16-bit, dunno.
> >
>
> struct irq_desc {
> unsigned int irq;
> #ifdef CONFIG_SPARSE_IRQ
> struct list_head list;
> struct list_head hash_entry;
> struct timer_rand_state *timer_rand_state;
> unsigned int *kstat_irqs;

That doesn't address my question.

The above array can be very large. Can we halve its size by using
16-bit quantities? Will this code ever encounter IRQ numbers larger
than 65536?

> >> +struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
> >> +{
> >> + struct irq_desc *desc;
> >> + struct list_head *hash_head;
> >> + unsigned long flags;
> >> + int node;
> >> +
> >> + desc = irq_to_desc(irq);
> >> + if (desc)
> >> + return desc;
> >> +
> >> + hash_head = sparseirqhashentry(irq);
> >> +
> >> + spin_lock_irqsave(&sparse_irq_lock, flags);
> >> +
> >> + /*
> >> + * We have to do the hash-walk again, to avoid races
> >> + * with another CPU:
> >> + */
> >> + list_for_each_entry(desc, hash_head, hash_entry)
> >> + if (desc->irq == irq)
> >> + goto out_unlock;
> >> +
> >> + if (cpu < 0)
> >> + cpu = smp_processor_id();
> >> +
> >> + node = cpu_to_node(cpu);
> >> + desc = kzalloc_node(sizeof(*desc), GFP_KERNEL, node);
> >
> > Oh for gawd's sake. PLEASE read Documentation/SubmitChecklist.
> > Carefully. We've already discussed this.
> there are 13 errors with checkpatch scripts. seems all about macro definition.

This has nothing to do with checkpatch. Documentation/SubmitChecklist
covers much more than that. In particular it descripbes various steps
which should be taken when runtime testing new code subissions.

> >
> > You cannot do a GFP_KERNEL allocation under spin_lock_irqsave().

Steps which would have detected this bug.


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