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] ARM: dma: imx: Fix deadlock bug
Date: Sat, 8 Jun 2013 22:19:08 +0100	[thread overview]
Message-ID: <20130608211908.GL18614@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAOMZO5CWT+kyf_H-Ms4yZ0isdvEadpcw22FagAUBurc5XzWQRA@mail.gmail.com>

On Sat, Jun 08, 2013 at 06:07:36PM -0300, Fabio Estevam wrote:
> Hi Alexander,
> 
> On Sat, Jun 8, 2013 at 5:56 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
> > =================================
> > [ INFO: inconsistent lock state ]
> > 3.10.0-rc4-next-20130607-00006-gf5bbfe3-dirty #59 Not tainted
> > ---------------------------------
> > inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
> > swapper/1 [HC0[0]:SC1[1]:HE1:SE0] takes:
> >  (&(&imxdma->lock)->rlock){?.-...}, at: [<c0230200>] imxdma_tasklet+0x1c/0x138
> > {IN-HARDIRQ-W} state was registered at:
> 
> I think the proper fix is to replace spin_lock/spin_unlock with
> spin_lock_bh/spin_unlock_bh inside imxdma_tasklet.

No, _bh versions are the tasklet-disabling versions.  You're already inside
tasklet context inside the tasklet itself.

What it's complaining about is that the tasklet takes a non-IRQ safe lock,
which _is_ taken in IRQ context.

So, what can happen is this:

- tasklet executes
- tasklet takes the lock
- interrupt occurs
- interrupt handler takes the same lock
 *deadlock*

but as I've just pointed out, there's a number of things wrong with this
driver, including one serious problem with the way the tasklet is written,
and merely changing the lock type doesn't fix it.  It needs a redesign.

  reply	other threads:[~2013-06-08 21:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-08 20:56 [PATCH] ARM: dma: imx: Fix deadlock bug Alexander Shiyan
2013-06-08 21:07 ` Fabio Estevam
2013-06-08 21:19   ` Russell King - ARM Linux [this message]
2013-06-08 21:15 ` Russell King - ARM Linux
2013-06-12  3:03   ` Vinod Koul
2013-07-15  8:13     ` Christoph Fritz
2013-07-15 10:01       ` Vinod Koul
2013-07-15 16:09         ` Christoph Fritz

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=20130608211908.GL18614@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).