lkml.org 
[lkml]   [2002]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: device model documentation 3/3
Date
On Wednesday 05 June 2002 20:56, Patrick Mochel wrote:

> No, that's a race that would affect all modular drivers. Ideally, we would
> want to pin the module in memory on file open, then decrement the usage
> count on close. We could do this by adding a struct module field to struct
> driver_file_entry...

Hmm, adding anything to driver_file_entry will make it take twice
as much memory (it's 8 * sizeof(void*) now, allocated with kmalloc),
so I wouldn't want to have that if there is another way.

Adding an owner field to struct device is probably not enough if bridge
devices should be able to add files to their children. You would need
at least two struct module pointers then. Also, it requires every device
driver to initialize the owner field (at least one for its struct
device_driver).

An alternative might be a rw_semaphore in struct device that protects
the store and show callbacks in its files. On module unload, rmmod would
just have to wait on the semaphore if it is held by any readers.
Of course that protects only against the race between module unload
and file open, but there can be others of anyone does get_device without
incrementing the use counts for the right modules.

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

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.047 / U:2.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site