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:

On Thu, 5 Aug 2010, Paul Goyette wrote:

OK, got it.

I'll have another set of patches in a few days.

Well, it was a slow day at the office today, so I found some time to work on this! :)

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!

Following up on all the various comments from jmcneil@, pooka@, and rmind@, I've attached a revised set of diffs. The most significant change between this and the previous revision is the separation of the kernconfig_lock_*() stuff into a separate kern_cfg.c source file. This allows inclusion of the kernel code directly into rump, rather than having to re-implement it in rump/klock.c



-------------------------------------------------------------------------
| 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  |
-------------------------------------------------------------------------

Attachment: ML.diff.tgz
Description: Binary data



Home | Main Index | Thread Index | Old Index