tech-kern archive

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

Re: Kernel modules

On Wed, Jan 16, 2008 at 12:48:20PM +0000, Andrew Doran wrote:

> What needs to happen for it to replace LKMs:
> - Conversion of the modules under sys/lkm.
> - Linker relocation code for mips, hppa.
> - Some changes to improve robustness in a couple of places.
> - Locking for kern_ksyms.c

I thought of a few more things this morning:

- We need some new calls for modules to make so that they can link what
  they provide into the system. Currently, kern_lkm.c takes care of most of
  this. One goal was to remove this indirection because it's complicated and
  difficult to understand what is going on. So the new style modules call
  directly into whatever subsystem they interact with to say "I'm here". 
  For file systems those calls already exist: vfs_attach() and vfs_detach(). 
  We need calls like syscall_attach() and so on. Picking sysvshm as an
  example, it's entries would never appear in the syscall table at boot,
  even if built into the system. When the module is initialized it would
  enter them.

- The syscall case raises a question about compat code, because in some
  places the compat code calls optional syscalls directly. We could either
  go through the syscall table to get at optional features (call *sy_call),
  or make compat code always depend on the optional features like sysvshm.
  The latter is problematic because then we grow a conflict between
  config(8) and the module dependencies so I think indirection is the way
  to go here.

- Device drivers are difficult because autoconf isn't really a good fit
  for loadables. As of right now the "built into the kernel" and "loadable"
  cases would probably have to be different for everything but pseudo
  devices. So what do we do here?

- Relocations need to be done in two stages (right now they are all done in
  one pass). First the local relocs so that the module's modinfo_t record is
  correct and can be read safely.  Then any requisite modules can be loaded.
  Once they are loaded, relocs depending on symbols external to the module
  can be done, and the module initialized as done now. Otherwise, we would
  fail to find symbols from a required module and fail the module load.


Home | Main Index | Thread Index | Old Index