usbatm subdriver registration w/o .driver_info
Roman Kagan
rkagan at mail.ru
Fri Jan 28 03:27:23 EST 2005
Hi Duncan,
On Fri, Jan 28, 2005 at 09:16:28AM +0100, Duncan Sands wrote:
> Hi Roman,
>
> > So the only thing we need to make sure is that list
> > traversal doesn't fail. I thought that choosing the appropriate list
> > primitives would do the job without locks.
>
> no, you need locks for this.
Yep, I already realized this. And resent the patch with rwlocks :)
> I guess you are thinking that when elements
> are added or removed, the links are set up in the right order so that someone
> traversing will still traverse correctly? This kind of reasoning is dangerous:
> on many architectures reads and writes can be reordered, so even if you put the
> right order in your code, it may not be the right order in practice unless you
> put memory barriers all over the place. The standard list primitives have no
> memory barriers because it would be a heavy cost for users who don't need them.
The *_rcu primitives do have barriers. But here locks are clearer and
safer, indeed.
> And in this case we don't care. Personally I think even a rw-semaphore is a waste
> of time - just use a standard semaphore. I may change my mind if you can show me
> someone capable of plugging and unplugging their modem a billion times a second :)
OK, do you want me to rewrite it with a semaphore? It wont take longer
than ten minutes :)
Starting to redo the patch,
Roman.
More information about the Usbatm
mailing list