Hello,

I'm coding a module that should load, run a benchmark inside the kernel and 
then unload itself. (It should work in a way similar to a userspace 
executable.) I was thinking about an approach like this:

        1) Spawn a kernel process in _init().
        2) Unload the module afterwards (from _init(), from the spawned kernel 
process or from system taskq).
        3) Wait for the kernel process to finish in _fini().

Unloading a module directly from _init() sounds like a typical deadlock 
scenario. (Or am I wrong?)

Unloading a module from the spawned process is no better (_fini() waits for the 
process to terminate and the process waits for _fini() to terminate).

The system taskq seems to be the only viable solution. But ... is it legal to 
sleep in _fini()?

AFAIK, automatic module unloading takes place in DEBUG kernels only. 
Furthermore, there can be a very long delay between _init() and _fini()... So a 
module should be able to unload itself somehow. Perhaps there is a better way 
to do this. If something of that kind is already used in the kernel, could 
someone tell me where it is, please?

Andrej

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
on-discuss mailing list
on-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/on-discuss

Reply via email to