linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Dove: Fix irq_to_pmu()
Date: Sun, 18 Nov 2012 23:08:05 +0000	[thread overview]
Message-ID: <20121118230805.GA3290@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20121118223125.GZ3290@n2100.arm.linux.org.uk>

On Sun, Nov 18, 2012 at 10:31:25PM +0000, Russell King - ARM Linux wrote:
> And there's yet another bug... this time in the kirkwood audio driver:
> 
> static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id)
> {
>         struct kirkwood_dma_priv *prdata = dev_id;
>         struct kirkwood_dma_data *priv = prdata->data;
>         unsigned long mask, status, cause;   
>         
>         mask = readl(priv->io + KIRKWOOD_INT_MASK);
>         status = readl(priv->io + KIRKWOOD_INT_CAUSE) & mask;
> 
>         cause = readl(priv->io + KIRKWOOD_ERR_CAUSE);
>         if (unlikely(cause)) {
>                 printk(KERN_WARNING "%s: got err interrupt 0x%lx\n",
>                                 __func__, cause);
>                 writel(cause, priv->io + KIRKWOOD_ERR_CAUSE);
>                 return IRQ_HANDLED;
>         }
> 
> What happens here if an underrun (0x20) interrupt happens?  Well, the
> kernel log looks something like this:

Actually, it's _far_ worse.  This interrupt handler is hooked into the
_normal_ I2S IRQ (21) - errors are reported via a separate IRQ (22).

So what happens is a normal IRQ (in INT_CAUSE) gets signalled.  It's at
that point we notice that an error occured... and clear the error,
leaving the normal interrupt set in INT_CAUSE, and return lying that
we'd serviced the interrupt.

The result is... IRQ21 is still pending, and ends up being the higher
priority interrupt, so we service IRQ21 again... and find that the
error cause bit has been set again... and return yet again IRQ_HANDLED
without actually servicing the interrupt...

I think we're far better off ripping out this "error handling".  If we
want to have this, then we should hook the _proper_ error interrupt, and
have some kind of back-off on it (which I think is the right solution).
Or if we merely want to report that an error occurred, then just get rid
of that "return IRQ_HANDLED" there.

  reply	other threads:[~2012-11-18 23:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-18 16:29 [PATCH] Dove: Attempt to fix PMU/RTC interrupts Russell King - ARM Linux
2012-11-18 16:39 ` [PATCH] Dove: Fix irq_to_pmu() Russell King - ARM Linux
2012-11-18 19:00   ` Sergei Shtylyov
2012-11-18 20:38     ` Russell King - ARM Linux
2012-11-18 21:02       ` Jason Cooper
2012-11-18 22:31         ` Russell King - ARM Linux
2012-11-18 23:08           ` Russell King - ARM Linux [this message]
2012-11-18 23:12             ` Jason Cooper
2012-11-18 23:09           ` kirkwood i2s lockup, was: " Jason Cooper
2012-11-19  6:11           ` Andrew Lunn
2012-11-21 15:59 ` [PATCH] Dove: Attempt to fix PMU/RTC interrupts Andrew Lunn
2012-11-21 16:53   ` Russell King - ARM Linux
2012-11-21 16:57     ` Jason Cooper

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=20121118230805.GA3290@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).