TODO.modules revision 1.3
11.3Spgoyette/* $NetBSD: TODO.modules,v 1.3 2016/08/05 02:27:14 pgoyette Exp $ */ 21.1Spgoyette 31.1SpgoyetteSome notes on the limitations of our current (as of 7.99.35) module 41.1Spgoyettesubsystem. This list was triggered by an Email exchange between 51.1Spgoyettechristos and pgoyette. 61.1Spgoyette 71.1Spgoyette1. Builtin drivers can't depend on modularized drivers (the modularized 81.1Spgoyette drivers are attempted to load as builtins). 91.1Spgoyette 101.1Spgoyette The assumption is that dependencies are loaded before those 111.1Spgoyette modules which depend on them. At load time, a module's 121.1Spgoyette undefined global symbols are resolved; if any symbols can't 131.1Spgoyette be resolved, the load fails. Similarly, if a module is 141.1Spgoyette included in (built-into) the kernel, all of its symbols must 151.1Spgoyette be resolvable by the linker, otherwise the link fails. 161.1Spgoyette 171.1Spgoyette There are ways around this (such as, having the parent 181.1Spgoyette module's initialization command recursively call the module 191.1Spgoyette load code), but they're gross hacks. 201.1Spgoyette 211.1Spgoyette2. Currently, config(1) has no way to "no define" drivers 221.1Spgoyette 231.1Spgoyette3. It is not always obvious by their names which drivers/options 241.1Spgoyette correspond to which modules. 251.1Spgoyette 261.1Spgoyette4. Right now critical drivers that would need to be pre-loaded (ffs, 271.1Spgoyette exec_elf64) are still built-in so that we don't need to alter the boot 281.1Spgoyette blocks to boot. 291.1Spgoyette 301.1Spgoyette This was a conscious decision by core@ some years ago. It is 311.1Spgoyette not a requirement that ffs or exec_* be built-in. The only 321.1Spgoyette requirement is that the root file-system's module must be 331.1Spgoyette available when the module subsystem is initialized, in order 341.1Spgoyette to load other modules. This can be accomplished by having the 351.1Spgoyette boot loader "push" the module at boot time. (It used to do 361.1Spgoyette this in all cases; currently the "push" only occurs if the 371.1Spgoyette booted filesystem is not ffs.) 381.1Spgoyette 391.1Spgoyette5. Not all parent bus drivers are capable of rescan, so some drivers 401.1Spgoyette just have to be built-in. 411.1Spgoyette 421.1Spgoyette6. Many (most?) drivers are not yet modularized 431.1Spgoyette 441.1Spgoyette7. There's currently no provisions for autoconfig to figure out which 451.1Spgoyette modules are needed, and thus to load the required modules. 461.1Spgoyette 471.1Spgoyette In the "normal" built-in world, autoconfigure can only ask 481.1Spgoyette existing drivers if they're willing to manage (ie, attach) a 491.1Spgoyette device. Removing the built-in drivers tends to limit the 501.1Spgoyette availability of possible managers. There's currently no 511.1Spgoyette mechanism for identifying and loading drivers based on what 521.1Spgoyette devices might be found. 531.1Spgoyette 541.2Spgoyette8. Even for existing modules, there are "surprise" dependencies with 551.2Spgoyette code that has not yet been modularized. 561.2Spgoyette 571.2Spgoyette For example, even though the bpf code has been modularized, 581.2Spgoyette there is some shared code in bpf_filter.c which is needed by 591.2Spgoyette both ipfilter and ppp. ipf is already modularized, but ppp 601.2Spgoyette is not. Thus, even though bpf_filter is modular, it MUST be 611.2Spgoyette included as a built-in module if you also have ppp in your 621.2Spgoyette configuration. 631.2Spgoyette 641.2Spgoyette Another example is sysmon_taskq module. It is required by 651.2Spgoyette other parts of the sysmon subsystem, including the 661.2Spgoyette "sysmon_power" module. Unfortunately, even though the 671.2Spgoyette sysmon_power code is modularized, it is referenced by the 681.2Spgoyette acpi code which has not been modularized. Therefore, if your 691.2Spgoyette configuration has acpi, then you must include the "sysmon_power" 701.2Spgoyette module built-in the kernel. And therefore your also need to 711.2Spgoyette have "sysmon_taskq" and "sysmon" built-in since "sysmon_power" 721.2Spgoyette rerefences them. 731.2Spgoyette 741.2Spgoyette9. As a corollary to #8 above, having dependencies on modules from code 751.2Spgoyette which has not been modularized makes it extremely difficult to test 761.2Spgoyette the module code adequately. Testing of module code should include 771.2Spgoyette both testing-as-a-built-in module and testing-as-a-loaded-module, and 781.2Spgoyette all dependencies need to be identified. 791.3Spgoyette 801.3Spgoyette10.Work is currently under way on creating a ppp module. Once this is 811.3Spgoyette complete, it will require additional work to possibly auto-load the 821.3Spgoyette compression routines. Until then, users would need to manually load 831.3Spgoyette the ppp_deflate and ppp_bsdcompress modules. 841.3Spgoyette 851.3Spgoyette Currently the compressors are separate modules which reside 861.3Spgoyette on-top-of ppp, and which call back to ppp for "registration"; 871.3Spgoyette thus, ppp itself cannot list the compressors as dependencies. 881.3Spgoyette See #1 above! 89