private: module_loaded ignores a module left in memory by a failed _init (G7) #9
Loading…
Reference in a new issue
No description provided.
Delete branch "g7-module-busy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Anima work item: G7
01a1028d-7fdb-7411-9ddb-af9b0f9d4444Stacked on #8 (
r5a-char-table).ddi::private::module_loadedno longer counts a module that is only in memory.Why
A module that another module requires is loaded by krtld and initialised by
mod_install_requisites(), which does not unload it when its_initfails;modunloadcannot either (moduninstallanswersEALREADYfor a module that is not installed),modinfodoes not list it, and it keepsmod_loadedset until it is loaded again. The first G7 guest run of illumos-drm found that this keptmisc/drm_coreout after a refusedmodload drv/i915(gfx-drm'smisc/drm, loaded as i915's dependency, refused in its_initand stayed in memory), untilmisc/drmwas loaded again (logs/hephaistos/illumos-drm/20261003-g7-run1-guards.log).Change
module_loadedistruefor a module that is installed (mod_installed), or in memory and busy (mod_loaded && mod_busy), as it is while its_initor_finiruns.mod_busychanges undermod_lock, andmod_installedis set before the module is released, so the walk sees an initialising module busy or installed._initstill exclude each other: each is in memory and busy before its own_initchecks, and both checks holdmod_lock, so the second sees the first.modctlbinding (mod_busyundermod_lock), DESIGN.md §5.12 row. Host unit test of the flag rule (in_memory): installed, in memory and busy count; only in memory, only busy, nothing do not.Evidence
cargo test -p ddi --no-default-features --lib12 passed;--features unstable-gate-cda5b9a49f-virtio --lib18 passed (incl.in_memory_from_flags,name_matches_like_strcmp); doctests (--target x86_64-unknown-illumos) pass; clippy with the private-tier feature, fmt and rustdoc clean.7e802e88a3, misc/drm_core built at this pin): a refuseddrv/i915leftmisc/drmin memory (::modctlbitsl) andmisc/drm_corethen loaded; a DTrace chill holdingmisc/drminmodinstall(loaded and busy, before_init) mademisc/drm_corerefuse; 100 concurrent loads of both cores ended with exactly one loaded each time. Logslogs/hephaistos/illumos-drm/20261003-g7-run3-{guards,overlap}.login the workspace.rselftestchecks (genunix,unixloaded;no_such_module_xyznot) still hold by construction (primary modules are installed) but were not rerun in a kernel.Open