All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Vasiliy Kulikov <segooon@gmail.com>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
	David Woodhouse <David.Woodhouse@intel.com>,
	Nicolas Pitre <nico@fluxnic.net>,
	Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>,
	Jiri Slaby <jslaby@suse.cz>,
	Stefani Seibold <stefani@seibold.net>, Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [bug] Fixing mutex_lock() under held spinlock
Date: Thu, 29 Jul 2010 13:34:56 +0000	[thread overview]
Message-ID: <201007291534.57188.arnd@arndb.de> (raw)
In-Reply-To: <20100729132223.GA19715@albatros>

On Thursday 29 July 2010, Vasiliy Kulikov wrote:
> I've found that cfi_cmdset and lpddr_cmds call mutex_lock() under held
> spinlock(). Maybe it was designed as a special locking scheme, so I
> don't try to fix it as I might create new complex locking problem.

No, it certainly looks like a bug and it seems to have been introduced by
http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-03/msg02798.html

Back in March, Stefani wrote:
| I have analyzed this drivers and IMHO i don't think there will be used
| from irq or atomic contexts. There is no request interrupt and there are
| a lot msleep and add_wait_queues/schedule calls during holding the
| mutex, which are not very useful in a irq or atomic context. But i don't
| know the whole mtd stack. 

It seems you have missed at least two places. It should be possible to
fix this by turning shared->lock into a mutex as well.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Vasiliy Kulikov <segooon@gmail.com>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
	David Woodhouse <David.Woodhouse@intel.com>,
	Nicolas Pitre <nico@fluxnic.net>,
	"Hans-Christian Egtvedt" <hans-christian.egtvedt@atmel.com>,
	Jiri Slaby <jslaby@suse.cz>,
	Stefani Seibold <stefani@seibold.net>, Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [bug] Fixing mutex_lock() under held spinlock
Date: Thu, 29 Jul 2010 15:34:56 +0200	[thread overview]
Message-ID: <201007291534.57188.arnd@arndb.de> (raw)
In-Reply-To: <20100729132223.GA19715@albatros>

On Thursday 29 July 2010, Vasiliy Kulikov wrote:
> I've found that cfi_cmdset and lpddr_cmds call mutex_lock() under held
> spinlock(). Maybe it was designed as a special locking scheme, so I
> don't try to fix it as I might create new complex locking problem.

No, it certainly looks like a bug and it seems to have been introduced by
http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-03/msg02798.html

Back in March, Stefani wrote:
| I have analyzed this drivers and IMHO i don't think there will be used
| from irq or atomic contexts. There is no request interrupt and there are
| a lot msleep and add_wait_queues/schedule calls during holding the
| mutex, which are not very useful in a irq or atomic context. But i don't
| know the whole mtd stack. 

It seems you have missed at least two places. It should be possible to
fix this by turning shared->lock into a mutex as well.

	Arnd

  reply	other threads:[~2010-07-29 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 13:22 [bug] Fixing mutex_lock() under held spinlock Vasiliy Kulikov
2010-07-29 13:22 ` Vasiliy Kulikov
2010-07-29 13:34 ` Arnd Bergmann [this message]
2010-07-29 13:34   ` Arnd Bergmann

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=201007291534.57188.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Artem.Bityutskiy@nokia.com \
    --cc=David.Woodhouse@intel.com \
    --cc=hans-christian.egtvedt@atmel.com \
    --cc=jslaby@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=segooon@gmail.com \
    --cc=stefani@seibold.net \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.