diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-20 20:46:25 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 16:52:59 +0200 |
commit | e89eb43863c2d9f11a3bbe766766fe646e6c50d9 (patch) | |
tree | 3d45bdf7efb5a37edb99f62cbea1d500b3003468 /kernel/irq | |
parent | 7ddfb650c7ef7a33a5ef11c0fdf5b3d837a47dba (diff) | |
download | op-kernel-dev-e89eb43863c2d9f11a3bbe766766fe646e6c50d9.zip op-kernel-dev-e89eb43863c2d9f11a3bbe766766fe646e6c50d9.tar.gz |
x86: sparse_irq needs spin_lock in allocations
Suresh Siddha noticed that we should have a spinlock around it.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq')
-rw-r--r-- | kernel/irq/handle.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 24c83a3..d638a91 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -107,6 +107,11 @@ static void init_kstat_irqs(struct irq_desc *desc, int nr_desc, int nr) } } +/* + * Protect the sparse_irqs_free freelist: + */ +static DEFINE_SPINLOCK(sparse_irq_lock); + #ifdef CONFIG_HAVE_SPARSE_IRQ static struct irq_desc *sparse_irqs_free; struct irq_desc *sparse_irqs; @@ -166,11 +171,13 @@ struct irq_desc *irq_to_desc(unsigned int irq) } return NULL; } + struct irq_desc *irq_to_desc_alloc(unsigned int irq) { struct irq_desc *desc, *desc_pri; - int i; + unsigned long flags; int count = 0; + int i; desc_pri = desc = sparse_irqs; while (desc) { @@ -182,6 +189,7 @@ struct irq_desc *irq_to_desc_alloc(unsigned int irq) count++; } + spin_lock_irqsave(&sparse_irq_lock, flags); /* * we run out of pre-allocate ones, allocate more */ @@ -223,6 +231,9 @@ struct irq_desc *irq_to_desc_alloc(unsigned int irq) else sparse_irqs = desc; desc->irq = irq; + + spin_unlock_irqrestore(&sparse_irq_lock, flags); + printk(KERN_DEBUG "found new irq_desc for irq %d\n", desc->irq); #ifdef CONFIG_HAVE_SPARSE_IRQ_DEBUG { |