tech-kern archive

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

Enabling built-in modules earlier in init



Currently, built-in kernel modules are not enabled until very late in the system initialization process, right after we create process #1 for init(8). (As an exception to this, secmodel modules are enabled much earlier.)

Unfortunately, this means that built-in modules are not available for use during much of the initialization process, and in particular they are not available during auto-configuration. This means that my recent changes to convert PCIVERBOSE, etc. into kernel modules does not work when the modules are built-in to the kernel!

I would like to enable the built-in modules much earlier, at least early enough to have them available during auto-configuration. The attached patch accomplishes this. I have briefly tested the patch, and it seems not to have any unwanted side-effects, but I would appreciate feedback from others who may be more familiar with the init sequence.

An alternative, but less desirable approach, would be to create a new class of modules for PCIVERBOSE and friends, and call module_class_int() early on to enable only these few modules.

Comments or suggestions?


-------------------------------------------------------------------------
| 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  |
-------------------------------------------------------------------------
Index: init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.420
diff -u -p -r1.420 init_main.c
--- init_main.c 10 Jun 2010 20:54:53 -0000      1.420
+++ init_main.c 15 Jun 2010 22:10:52 -0000
@@ -495,6 +495,12 @@ main(void)
 
        spldebug_start();
 
+       /*
+        * Load any remaining builtin modules, and hand back temporary
+        * storage to the VM system.
+        */
+       module_init_class(MODULE_CLASS_ANY);
+
        /* Configure the system hardware.  This will enable interrupts. */
        configure();
 
@@ -593,12 +599,6 @@ main(void)
                panic("fork init");
 
        /*
-        * Load any remaining builtin modules, and hand back temporary
-        * storage to the VM system.
-        */
-       module_init_class(MODULE_CLASS_ANY);
-
-       /*
         * Finalize configuration now that all real devices have been
         * found.  This needs to be done before the root device is
         * selected, since finalization may create the root device.


Home | Main Index | Thread Index | Old Index