Lockdep violation in pcmcia
stern at rowland.harvard.edu
Tue Nov 3 10:22:59 EST 2009
On Mon, 2 Nov 2009, Dominik Brodowski wrote:
> 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:
> > [ 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...
Yeah; this is on a very old laptop running an FC4 distribution. I
haven't bothered to upgrade it because there's no point; the CPU speed,
the amount of RAM, and the size of the hard disk are all very limited.
But of course this doesn't affect the main point. Lockdep violations
shouldn't occur, no matter what userspace does.
> > 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
(Actually the violation occurs during system shutdown.)
I don't mind. It hasn't caused any problems. I just wanted to make
sure that it was recognized as a real issue and was being dealt with
More information about the linux-pcmcia