[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221216150441.200533-3-manfred@colorfullife.com>
Date: Fri, 16 Dec 2022 16:04:41 +0100
From: Manfred Spraul <manfred@...orfullife.com>
To: LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: 1vier1@....de, Manfred Spraul <manfred@...orfullife.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
Subject: [PATCH 3/3] kernel/irq/manage.c: disable_irq() might sleep.
With the introduction of threaded interrupt handlers, it is virtually
never safe to call disable_irq() from non-premptible context.
Thus: Update the documentation, add a might_sleep() to catch any
offenders.
Fixes: 3aa551c9b4c4 ("genirq: add threaded interrupt handler support")
Signed-off-by: Manfred Spraul <manfred@...orfullife.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
---
kernel/irq/manage.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 5b7cf28df290..8ce75495e04f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -723,10 +723,13 @@ EXPORT_SYMBOL(disable_irq_nosync);
* to complete before returning. If you use this function while
* holding a resource the IRQ handler may need you will deadlock.
*
- * This function may be called - with care - from IRQ context.
+ * Can only be called from preemptible code as it might sleep when
+ * an interrupt thread is associated to @irq.
+ *
*/
void disable_irq(unsigned int irq)
{
+ might_sleep();
if (!__disable_irq_nosync(irq))
synchronize_irq(irq);
}
--
2.38.1
Powered by blists - more mailing lists