tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Module and device configuration locking [was Re: Modules loading modules?]



On Thu, 5 Aug 2010, Paul Goyette wrote:

Attached is the latest version of this change. For simplicity, I have broken the patches up into five separate groups:

Part 1 defines a set of new kernel locking primitives in file
kern/kern_lock.c to implement the recursive kernconfig_mutex. (I'm not really stuck on the name, so open to alternative suggestions!) All of the locking in sys/kern_module.c has been updated to use this instead of the internal module_lock mutex. Additionally, the module_autoload() routine now does its own locking, rather than requiring its caller to do it. And the description of locking in the module(9) man page is updated.

Part 2 removes all of the explicit module_{,un}lock() calls from the various xxx_verbose modules that I'd previous worked on.

Part 3 removes all of the explicit module_{,un}lock() calls from other bits and pieces of the kernel. In a couple of places, new calls to
kernconfig_{,un}lock() are inserted.

Part 4 updates rump to provide equivalent locking routines. (pooka, I would appreciate you looking at this.)

Part 5 adds a new atf test-case to the existing module tests to verify that recursion actually works!

I should add that I'm actually running with these changes on one of my local machines with no visible problems, and the above-added test case works.

The machine has a "AMD Phenom(tm) 9600 Quad-Core Processor" at 2.3MHz.

{103} modstat
NAME             CLASS      SOURCE     REFS  SIZE     REQUIRES
bpf              driver     builtin    0     -        -
compat           misc       builtin    0     -        -
coredump         misc       filesys    1     3402     -
exec_elf64       misc       filesys    0     7960     coredump
exec_script      misc       filesys    0     1256     -
ffs              vfs        boot       0     153316   -
kernfs           vfs        filesys    0     12914    -
nfs              vfs        filesys    0     159471   -
ptyfs            vfs        filesys    0     10118    -
secmodel_bsd44   secmodel   builtin    0     -        suser,securelevel
securelevel      secmodel   builtin    1     -        -
suser            secmodel   builtin    1     -        -
tmpfs            vfs        filesys    0     19513    -
wapbl            vfs        builtin    0     -        -
{104}



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index