linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] genirq: drop synchronize_irq() unless CONFIG_SMP
@ 2012-01-18  7:59 Gerlando Falauto
  2012-01-18  7:59 ` [PATCH 1/1] " Gerlando Falauto
  0 siblings, 1 reply; 2+ messages in thread
From: Gerlando Falauto @ 2012-01-18  7:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Gerlando Falauto, Thomas Gleixner, Ingo Molnar, Holger Brunck

Up until 2.6.28, synchronize_irq() was only implemented
when CONFIG_SMP was defined, and this was consistent
between kernel/irq/manage.c and include/linux/hardirq.h

At some point before 2.6.29, a second condition
became necessary, CONFIG_GENERIC_HARDIRQS, and this was
still consistent in that both files showed some

 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)

Then before 2.6.30:

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

changed this so that include/linux/hardirq.h declares a function when
 #if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
whereas kernel/irq/manage.c always defines one anyway.

Since synchronize_irq() only makes sense under SMP, we both declare
and define one when CONFIG_SMP=y.

CONFIG_GENERIC_HARDIRQS is a necessary condition for compiling
kernel/irq/manage.c, so if you are not using it 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.

Other drivers were fixed by changing disable_irq() to
disable_irq_nosync(), with references to the above patch,
like for instance:

:commit f43ab901005c2bb3c5440e91b6efae9f5db02e7c
:Author: Nelson Castillo <arhuaco@freaks-unidos.net>
:Date:   Tue May 12 13:26:47 2009 -0700
:
:    mfd: pcf50633: fix unsafe disable_irq()

:commit 950312ce22696ddfa42a957bdadaa9c24151e679
:Author: Andrew Randrianasulu <randrik_a@yahoo.com>
:Date:   Thu May 14 11:29:27 2009 -0700
:
:    MIPS: IP32: Fix hang on shutdown in power button interrupt handler.

:commit 7e9e05cad94217498e4d9bd6ef7137b4e9e7ed64
:Author: Ralf Baechle <ralf@linux-mips.org>
:Date:   Sat May 16 12:23:45 2009 +0100
:
:    MIPS: IP22: Fix hang in power button interrupt handler

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>

Gerlando Falauto (1):
  genirq: drop synchronize_irq() unless CONFIG_SMP

 include/linux/hardirq.h |    2 +-
 kernel/irq/manage.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] genirq: drop synchronize_irq() unless CONFIG_SMP
  2012-01-18  7:59 [PATCH 0/1] genirq: drop synchronize_irq() unless CONFIG_SMP Gerlando Falauto
@ 2012-01-18  7:59 ` Gerlando Falauto
  0 siblings, 0 replies; 2+ messages in thread
From: Gerlando Falauto @ 2012-01-18  7:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Gerlando Falauto, Thomas Gleixner, Ingo Molnar, Holger Brunck

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

:commit 3aa551c9b4c40018f0e261a178e3d25478dc04a9
:Author: Thomas Gleixner <tglx@linutronix.de>
: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@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-18  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-18  7:59 [PATCH 0/1] genirq: drop synchronize_irq() unless CONFIG_SMP Gerlando Falauto
2012-01-18  7:59 ` [PATCH 1/1] " Gerlando Falauto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).