From: Thomas Gleixner <tglx@linutronix.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Arjan van de Veen <arjan@infradead.org>,
Jon Masters <jonathan@jonmasters.org>,
Sven Dietrich <sdietrich@suse.de>,
David Brownell <david-b@pacbell.net>
Subject: Re: [patch 1/2] genirq: add threaded interrupt handler support
Date: Mon, 23 Mar 2009 20:10:22 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.0903232005380.29264@localhost.localdomain> (raw)
In-Reply-To: <20090323185618.GA11432@infradead.org>
Christoph,
On Mon, 23 Mar 2009, Christoph Hellwig wrote:
> I like the API and concept of the patch a lot.
>
> some minor comments:
>
> > + switch (ret) {
> > + case IRQ_WAKE_THREAD:
> > + /*
> > + * Wake up the handler thread for this
> > + * action. In case the thread crashed and was
> > + * killed we just pretend that we handled the
> > + * interrupt. The hardirq handler above has
> > + * disabled the device interrupt, so no irq
> > + * storm is lurking.
> > + */
>
> We probably wants some sort of error check to catch drivers returning
> IRQ_WAKE_THREAD without actually defining a threaded handler here.
Yep, got lost in the restructuring.
> > +static inline int irq_thread_should_run(struct irqaction *action)
> > +{
> > + return test_and_clear_bit(IRQTF_RUNTHREAD, &action->thread_flags);
> > +}
> > +
> > +static int irq_wait_for_interrupt(struct irqaction *action)
> > +{
> > + while (!kthread_should_stop()) {
> > + set_current_state(TASK_INTERRUPTIBLE);
> > + if (irq_thread_should_run(action)) {
>
> Does adding the helper for one use really help readability?
:)
> > + __set_current_state(TASK_RUNNING);
> > + return 0;
> > + } else
> > + schedule();
>
> No need for the else here :)
Sigh. I was staring at this construct for a while because it looked
strange :)
> > + if (new->thread_fn) {
> > + struct task_struct *t;
> > +
> > + t = kthread_create(irq_thread, new, "irq/%d-%s", irq,
> > + new->name);
> > + if (IS_ERR(t))
> > + return PTR_ERR(t);
> > + /*
> > + * We keep the reference to the task struct even if
> > + * the thread dies to avoid that the interrupt code
> > + * references an already freed task_struct.
> > + */
> > + get_task_struct(t);
> > + new->thread = t;
> > + wake_up_process(t);
> > + }
>
> We should really introduce a refcounted variant of the kthread helpers.
> Not an argument against the patch, just a public mental note.
Thought about that already, but did not come around to implement it.
> > /**
> > - * request_irq - allocate an interrupt line
> > + * request_threaded_irq - allocate an interrupt line
> > * @irq: Interrupt line to allocate
> > - * @handler: Function to be called when the IRQ occurs
> > + * @handler: Function to be called when the IRQ occurs.
> > + * Primary handler for threaded interrupts
> > + * @thread_fn: Function called from the irq handler thread
> > + * If NULL, no irq thread is created
>
> The indentation is messed up here.
Thanks for the review !
tglx
next prev parent reply other threads:[~2009-03-23 19:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-23 18:23 [patch 0/2] Add support for threaded interrupt handlers - V3 Thomas Gleixner
2009-03-23 18:23 ` [patch 1/2] genirq: add threaded interrupt handler support Thomas Gleixner
2009-03-23 18:56 ` Christoph Hellwig
2009-03-23 19:10 ` Thomas Gleixner [this message]
2009-03-23 20:59 ` genirq: add threaded interrupt handler support - review fixups Thomas Gleixner
2009-03-23 18:23 ` [patch 2/2] genirq: add support for threaded interrupts to devres Thomas Gleixner
2009-03-24 21:44 ` [patch 0/2] Add support for threaded interrupt handlers - V3 David Brownell
2009-03-24 21:54 ` Thomas Gleixner
2009-03-24 23:38 ` David Brownell
2009-03-25 7:39 ` Thomas Gleixner
2009-03-25 20:18 ` David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.0903232005380.29264@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=david-b@pacbell.net \
--cc=hch@infradead.org \
--cc=jonathan@jonmasters.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=sdietrich@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®