mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pcmcia@lists.infradead.org,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Lockdep violation in pcmcia
Date: Mon, 2 Nov 2009 22:38:37 +0100	[thread overview]
Message-ID: <20091102213837.GA26200@isilmar.linta.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0911021610030.28727-100000@netrider.rowland.org>

Hey,

On Mon, Nov 02, 2009 at 04:21:23PM -0500, Alan Stern wrote:
> I've been getting these warnings for a long, long time, and finally 
> decided to report them:

Thanks!

> [ 1893.036023] other info that might help us debug this:
> [ 1893.036023] 2 locks held by cardmgr/1457:

Wow, cardmgr still in use... I had hoped it had already disappeared on
non-embedded systems...

> The cause is easy enough to track down.  In pcmcia_ioctl.c,
> pcmcia_adjust_resource_info() does a down_read() on
> pcmcia_socket_list_rwsem.  While holding the rwsem, one of the pathways
> calls the s->resource_ops->add_mem method.  On my system this method is
> realized by adjust_memory() in rsrc_nonstatic.c, which does its own
> down_read() on the same rwsem -- i.e., a recursive locking attempt.
> 
> The reason lockdep warns about this behavior is that it can lead to
> deadlock in the wrong circumstances, namely, if another thread were to
> do a down_write() in between the two down_read() calls.
> 
> Would it be correct simply to omit the down_read() in adjust_memory()?

No, for there are other code paths reaching adjust_memory() not holding a
(read) lock on this semaphore. As pcmcia_ioctl.c is on its way out anyways:
would you mind keeping it as it is, for a down_write() call is quite
unlikely during the only time cardmgr actually does this call (system
startup)?

Best,
	Dominik

  reply	other threads:[~2009-11-02 21:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-02 21:21 Alan Stern
2009-11-02 21:38 ` Dominik Brodowski [this message]
2009-11-03 15:22   ` Alan Stern

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=20091102213837.GA26200@isilmar.linta.de \
    --to=linux@dominikbrodowski.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=stern@rowland.harvard.edu \
    /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®