mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
To: Ben Nizette <bn@niasdigital.com>
Cc: tglx@linutronix.de, David Brownell <david-b@pacbell.net>,
	kernel@avr32linux.org, linux-kernel@vger.kernel.org,
	imre.deak@nokia.com, mingo@elte.hu
Subject: Re: [REGRESSION] threaded interrupt handler support breaks (some) irq handling on AVR32
Date: Wed, 15 Apr 2009 10:33:52 +0200	[thread overview]
Message-ID: <20090415103352.5ee43824@hskinnemoen-d830> (raw)
In-Reply-To: <20090415095710.5c853a7f@hskinnemoen-d830>

Haavard Skinnemoen wrote:
> Ben Nizette wrote:
> > static irqreturn_t ads7846_irq(int irq, void *handle)
> > {
> > 	struct ads7846 *ts = handle;
> > 	unsigned long flags;
> > 
> > 	spin_lock_irqsave(&ts->lock, flags);
> > 	if (likely(get_pendown_state(ts))) {
> > 		if (!ts->irq_disabled) {
> > 			/* The ARM do_simple_IRQ() dispatcher doesn't act
> > 			 * like the other dispatchers:  it will report IRQs
> > 			 * even after they've been disabled.  We work around
> > 			 * that here.  (The "generic irq" framework may help...)
> > 			 */
> > 			ts->irq_disabled = 1;
> > 			disable_irq(ts->spi->irq);  
> 
> Shouldn't that be disable_irq_nosync()?

Ok, simply stating that without providing an explanation was probably
not so helpful...

I think the problem is that disable_irq() calls synchronize_irq(),
which waits until the corresponding interrupt handler is no longer
running on any CPU. And since we're calling it from the interrupt
handler, we'll have a deadlock because the interrupt handler won't
return until synchronize_irq() returns, and that won't happen until the
interrupt handler returns and so on.

So I think changing disable_irq() into disable_irq_nosync() (which
doesn't call synchronize_irq()) will fix it, though I'm not sure what
difference the threaded interrupt handling code makes -- AFAICT, this
code has always been dangerous.

Haavard

  reply	other threads:[~2009-04-15  8:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1239685153.19815.12.camel@linux-51e8.site>
2009-04-14  8:37 ` Ben Nizette
2009-04-15  1:30   ` Ben Nizette
2009-04-15  7:57     ` Haavard Skinnemoen
2009-04-15  8:33       ` Haavard Skinnemoen [this message]
2009-04-15 16:01         ` Bill Gatliff
2009-04-16  8:40           ` Haavard Skinnemoen
2009-04-16 13:25             ` Bill Gatliff
2009-04-16  0:41       ` [PATCH] ads7846: fix unsafe disable_irq (was [REGRESSION] threaded interrupt handler support breaks (some) irq handling on AVR32) Ben Nizette
2009-04-16  1:58         ` Dmitry Torokhov
2009-04-14  5:46 [REGRESSION] threaded interrupt handler support breaks (some) irq handling on AVR32 Ben Nizette

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=20090415103352.5ee43824@hskinnemoen-d830 \
    --to=haavard.skinnemoen@atmel.com \
    --cc=bn@niasdigital.com \
    --cc=david-b@pacbell.net \
    --cc=imre.deak@nokia.com \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.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®