[PATCH 1/1] genirq: drop synchronize_irq() unless CONFIG_SMP

From: Gerlando Falauto
Date: Wed Jan 18 2012 - 03:00:53 EST


Since synchronize_irq() only makes sense under SMP,
restore the behavior prior to:

:commit 3aa551c9b4c40018f0e261a178e3d25478dc04a9
:Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
:Date: Mon Mar 23 18:28:15 2009 +0100
:
: genirq: add threaded interrupt handler support

so that it is declared and defined only when CONFIG_SMP=y.
Note that kernel/irq/manage.c only gets compiled when
CONFIG_GENERIC_HARDIRQS=y -- if this is not the case,
you should implement your own.

This fixes startup deadlocks in SMP-unaware drivers which call
disable_irq() within its own handler, and used to work
(by chance), up until 2.6.29.

Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Holger Brunck <holger.brunck@xxxxxxxxxxx>
Signed-off-by: Gerlando Falauto <gerlando.falauto@xxxxxxxxxxx>
---
include/linux/hardirq.h | 2 +-
kernel/irq/manage.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index ba36217..82b2e75 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -123,7 +123,7 @@
# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
#endif

-#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
+#if defined(CONFIG_SMP)
extern void synchronize_irq(unsigned int irq);
#else
# define synchronize_irq(irq) barrier()
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 0a7840a..410da46 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -28,6 +28,7 @@ static int __init setup_forced_irqthreads(char *arg)
early_param("threadirqs", setup_forced_irqthreads);
#endif

+#if defined(CONFIG_SMP)
/**
* synchronize_irq - wait for pending IRQ handlers (on other CPUs)
* @irq: interrupt number to wait for
@@ -72,7 +73,6 @@ void synchronize_irq(unsigned int irq)
}
EXPORT_SYMBOL(synchronize_irq);

-#ifdef CONFIG_SMP
cpumask_var_t irq_default_affinity;

/**
--
1.7.1

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