lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1301050558.2250.187.camel@laptop>
Date:	Fri, 25 Mar 2011 11:55:58 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	David Collins <collinsd@...eaurora.org>,
	Liam Girdwood <lrg@...mlogic.co.uk>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: Deadlock scenario in regulator core

On Tue, 2011-03-22 at 20:07 -0400, Steven Rostedt wrote:
> On Tue, 2011-03-22 at 16:41 -0700, David Collins wrote:
> 
> > There seem to be very few uses of mutex_lock_nested() in the kernel.  Most
> > of them use subclass = SINGLE_DEPTH_NESTING.  Would this be sufficient for
> > usage in the regulator core in _notifier_call_chain (and perhaps other
> > places) or should some other subclass be used?
> 
> Note, I do not know this code well enough to say. I'm assuming that an
> rdevA on a rdevB->supply_list never has rdevB on its own
> rdevA->supply_list.
> 
> If this is the case, and that you only ever have a lock nesting of one,
> then sure, use the SINGLE_DEPTH_NESTING.
> 
> Peter or Ingo could correct me if I'm wrong.

Right, so be aware that you can annotate an actual deadlock away with
mutex_lock_nested(), so use with care. The thing to avoid is something
like:

  mutex_lock(instance1);
  mutex_lock_nested(instance2, SINGLE_DEPTH_NESTING);

vs

  mutex_lock(instance2);
  mutex_lock_nested(instance1, SINGLE_DEPTH_NESTING);

Lockdep will not complain anymore but it will cause deadlocks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ