From: ebiederm@xmission.com (Eric W. Biederman)
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Tejun Heo <tj@kernel.org>, Peter Zijlstra <peterz@infradead.org>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Lockdep false positive in sysfs
Date: Sat, 28 Apr 2012 19:35:32 -0700 [thread overview]
Message-ID: <m1obqb8du3.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1204282153520.6752-100000@netrider.rowland.org> (Alan Stern's message of "Sat, 28 Apr 2012 22:00:01 -0400 (EDT)")
Alan Stern <stern@rowland.harvard.edu> writes:
> On Fri, 27 Apr 2012, Eric W. Biederman wrote:
>
>> However it would be nice if we could sort out the locking so that it
>> isn't so tricky that neither lockdep nor sparse can figure it out.
>>
>> I have the sneaking suspicion that idioms that tangle up our automatic
>> tools are also idioms that are likely to result in maintenance problems
>> at some point.
>
> That may well be true, but it won't be easy to avoid them. At the
> least, it would require a careful analysis of the device tree usage.
>
>> Another possibility to to look at the situation and realize that pci has
>> a maxium depth of 256 (bus numbers). And that usb also has a maxium
>> depth of I believe 256 ( If I read it right usb hubs are transparent to
>> usb enumeration so the maximum depth is the maximum number of usb ids
>> and I think the usb id is a 8 bit number).
>
> USB has a maximum depth of 7 or so. It's limited by the number of hubs
> allowed on the path between the host and a device.
>
>> I don't think anything else
>> even nests so deeply. So it may be reasonable to declare an array of
>> 256 or perhaps 1024 lockdep keys and limit the device tree when lockdep
>> is enabled to 1024 layers deep.
>>
>> At which point we are at a point where lockdep can actually analyze the
>> behavior.
>
> Unfortunately, we are not. As I mentioned earlier, the device "tree"
> is really a forest. Locks are sometimes acquired in orders that are
> not strictly downward.
Then it sounds like for the device tree in general this is a limitation.
For sysfs with your problem usb attribute this looks like a real
solution.
>> I don't mind the attitude we are clever careful programmers we can
>> handle the complexity and we can get away without the tool help us, but
>> I would much rather see the attitude that we are clever careful
>> programmers and we can figure out how to make the tool help us instead
>> of just ignoring it.
>
> I'm certainly open to suggestions as to how to improve the situation,
> but the simple-minded "keep track of the depth in the tree" approach
> doesn't work.
For the general device tree perhaps. For the problem of your removal
of your sysfs attribute the solution should be sufficient. I don't
particularly like it because it will take a lot of testing to find any
bugs that lockdep might reveal but at least you will have a fighting
chance.
I would like to look at the general problem of the device tree locking.
Unfortunately I am tilting at enough other windmills right now that I
can't do that problem justice.
Eric
prev parent reply other threads:[~2012-04-29 2:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-25 18:58 Lockdep false positive in sysfs Alan Stern
2012-04-25 21:59 ` Tejun Heo
2012-04-26 8:16 ` Eric W. Biederman
2012-04-26 18:14 ` Alan Stern
2012-04-26 22:17 ` Tejun Heo
2012-04-27 15:57 ` Alan Stern
2012-04-27 16:09 ` Tejun Heo
2012-05-03 21:30 ` Alan Stern
2012-05-04 16:52 ` Tejun Heo
2012-05-04 19:08 ` Alan Stern
2012-05-07 19:46 ` Tejun Heo
2012-05-07 21:51 ` Alan Stern
2012-05-07 21:55 ` Tejun Heo
2012-05-08 18:53 ` Alan Stern
2012-05-09 17:41 ` Tejun Heo
2012-05-09 17:47 ` Alan Stern
2012-05-09 17:48 ` Tejun Heo
2012-04-27 16:27 ` Eric W. Biederman
2012-04-27 18:27 ` Alan Stern
2012-04-27 20:17 ` Tejun Heo
2012-04-27 21:09 ` Eric W. Biederman
2012-04-27 21:16 ` Tejun Heo
2012-04-29 2:00 ` Alan Stern
2012-04-29 2:35 ` Eric W. Biederman [this message]
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=m1obqb8du3.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--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 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).