LWN.net Logo

Re: [patch 3/4] genirq: add a quick check handler

From:  Christoph Hellwig <hch-AT-infradead.org>
To:  Thomas Gleixner <tglx-AT-linutronix.de>
Subject:  Re: [patch 3/4] genirq: add a quick check handler
Date:  Sat, 28 Feb 2009 17:24:09 -0500
Message-ID:  <20090228222408.GB7797@infradead.org>
Cc:  LKML <linux-kernel-AT-vger.kernel.org>, Andrew Morton <akpm-AT-linux-foundation.org>, Ingo Molnar <mingo-AT-elte.hu>, Peter Zijlstra <peterz-AT-infradead.org>, Arjan van de Veen <arjan-AT-infradead.org>, Steven Rostedt <rostedt-AT-goodmis.org>, Jon Masters <jonathan-AT-jonmasters.org>
Archive-link:  Article, Thread

I really disagree with the notation of the pre-handler.  Instead of
adding an additional pre handler method you should add a new threadfn
method.  The handler could just as now handle/not handle the interrupt,
or as a third option defer it to the thread.  That makes the different
semantics a lot clearer, and means ->handler and ->threadfn both have
very well defined contexts, instead of sometimes calling ->handler
sometimes from irq and sometimes from thread context.  This also
makes it much easier for complex hardware that might have simple and
fast interrupts that it may want to handle directly from hardirq context
in just a couple of cycles or complex interrupts that might be deferred
to process context.

In that model that main loop in handle_IRQ_event would look something
like this:


	do {
		ret = action->handler(irq, action->dev_id);
		switch (ret) {
		case IRQ_HANDLED:
			status |= action->flags;
			break;
		case IRQ_WAKE_THREAD:
			if (likely(!test_bit(IRQTF_DIED,
					     &action->thread_flags))) {
				set_bit(IRQTF_RUNTHREAD, &action->thread_flags);
				wake_up_process(action->thread);
			}
			/*
			 * Set it to handled so the spurious check
			 * does not trigger.
			 */
			ret = IRQ_HANDLED;
			break;
		}
		retval |= ret;
		action = action->next;
	 } while (action);


(Log in to post comments)

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds