Re: [PATCH] Add SA_PERCPU_IRQ flag support

From: Dimitri Sivanich
Date: Tue Mar 21 2006 - 19:51:55 EST


On Tue, Mar 21, 2006 at 03:37:47PM -0800, Andrew Morton wrote:
> hm. Last time around I pointed out that we should be checking that all
> handlers for this IRQ agree about the percpuness. What happened to
> that?

I believe this version has what you are looking for.

Signed-off-by: Dimitri Sivanich <sivanich@xxxxxxx>

Index: linux-2.6.15/kernel/irq/manage.c
===================================================================
--- linux-2.6.15.orig/kernel/irq/manage.c 2006-03-20 13:11:01.766522017 -0600
+++ linux-2.6.15/kernel/irq/manage.c 2006-03-21 18:44:52.297990979 -0600
@@ -209,10 +209,14 @@ int setup_irq(unsigned int irq, struct i
p = &desc->action;
if ((old = *p) != NULL) {
/* Can't share interrupts unless both agree to */
- if (!(old->flags & new->flags & SA_SHIRQ)) {
- spin_unlock_irqrestore(&desc->lock,flags);
- return -EBUSY;
- }
+ if (!(old->flags & new->flags & SA_SHIRQ))
+ goto mismatch;
+
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+ /* All handlers must agree on per-cpuness */
+ if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU))
+ goto mismatch;
+#endif

/* add new interrupt at end of irq queue */
do {
@@ -223,7 +227,10 @@ int setup_irq(unsigned int irq, struct i
}

*p = new;
-
+#if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
+ if (new->flags & SA_PERCPU_IRQ)
+ desc->status |= IRQ_PER_CPU;
+#endif
if (!shared) {
desc->depth = 0;
desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT |
@@ -241,6 +248,12 @@ int setup_irq(unsigned int irq, struct i
register_handler_proc(irq, new);

return 0;
+
+mismatch:
+ spin_unlock_irqrestore(&desc->lock, flags);
+ printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__);
+ dump_stack();
+ return -EBUSY;
}

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