Oliver Neukum wrote:
Am Dienstag, 21. September 2004 19:58 schrieb David Brownell:
Oliver Neukum wrote:
IMHO USB is the unusual case because it is a bus and a tree. A
generic locking model probably has to lock the whole bus...
A generic model has to understand that any computer nowadays is
built from a tree of busses ... just like USB is built from
a tree of hubs. Trees are the _normal_ case.
But a tree can be treated as a bus by a lock on the root,
the reverse is not true.
If the reverse is not true, then the locking model has
at least one gaping hole. Because every bus can have
devices in it whose drivers expose devices behind the
one on that bus; that bus is the root of a (sub)tree.
And for that matter, when the bus segment itself is
suspended (as with USB, or PCI), that's also a branch
in a tree ... make it _two_ gaping holes.
Contention is curious; something like dpm_sem wouldn't really be
high-contention if it weren't trying to protect the power lists.
The problem there is that lock tries to protect too much, with
resulting self-deadlocks.
What is the alternative?
Locks that are focussed on the data they're protecting;
which is what they should always be doing anyway.
In the dpm_sem case, there are basic rules of thumb being
violated by using a semaphore (a) to lock a list, rather than
just a spinlock: grab lock, update, release; (b) to protect
something else (TBS), during operations which may need to
update those lists.
- Dave
Regards
Oliver
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel