[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120319145903.GH2147@dhcp-26-207.brq.redhat.com>
Date: Mon, 19 Mar 2012 15:59:05 +0100
From: Alexander Gordeev <agordeev@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] genirq: Clean up IRQ threaded handler exit path
The fact that a threaded handler is serving interrupts is encoded in
irq_thread flag explicitly and in the kthread's should_stop flag
implicitly. This fix eliminates the duplicate by checking should_stop
flag only.
This fix also converts irq_thread flag into a new per process flag that
indicates a kernel thread is actually a IRQ thread handler. As an effect
thread handlers become distinguishable. As a result we can have a single
exit path rather than two.
Signed-off-by: Alexander Gordeev <agordeev@...hat.com>
---
kernel/irq/manage.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index bf606a5..03a4c28 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -808,11 +808,7 @@ static int irq_thread(void *data)
* cannot touch the oneshot mask at this point anymore as
* __setup_irq() might have given out currents thread_mask
* again.
- *
- * Clear irq_thread. Otherwise exit_irq_thread() would make
- * fuzz about an active irq thread going into nirvana.
*/
- current->irq_thread = 0;
return 0;
}
@@ -828,6 +824,16 @@ void exit_irq_thread(void)
if (!tsk->irq_thread)
return;
+ /*
+ * __free_irq() ensured with synchronize_irq() that the thread
+ * finished running. So if should_stop flag is set we are guaranteed
+ * exiting normally. Conversly, if the handler crashed and was killed
+ * then synchronize_irq() would not have returned and __free_irq()
+ * would not have called kthread_stop().
+ */
+ if (kthread_should_stop())
+ return;
+
action = kthread_data(tsk);
printk(KERN_ERR
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists