init: Add Ubuntu support for module loading and entropy initialization#2650
Open
jiechen0826 wants to merge 2 commits intomicrosoft:mainfrom
Open
init: Add Ubuntu support for module loading and entropy initialization#2650jiechen0826 wants to merge 2 commits intomicrosoft:mainfrom
jiechen0826 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
On distros where hv_sock is a loadable module (e.g., Ubuntu), the vsock transport used by init_entropy is not available until modules are loaded. Move init_entropy() after load_all_modules().
On Ubuntu, hv_netvsc, hv_sock, bridge, and other networking modules are loadable (=m) rather than built-in (=y). The existing ftw()-based load_all_modules() may not resolve them reliably by path alone. Add preload_networking_modules() to load critical modules by name before the general module scan. Also enable KMOD=1 in the default Makefile and improve module load logging with structured messages. Without hv_netvsc: hot-added NICs timeout waiting for sysfs net interface. Without hv_sock: vsock-based entropy and GCS communication fail. Signed-off-by: Jie Chen <jiechen3@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix UVM boot failures on Ubuntu-based rootfs where critical kernel modules
(hv_netvsc, hv_sock, bridge, etc.) are loadable (=m) rather than built-in (=y).
Problem
On Ubuntu, unlike Mariner, networking and vsock modules are not compiled into the kernel.
This causes two boot failures:
claims the vmbus device because
hv_netvscisn't loaded, resulting in:init_entropy()was called beforeload_all_modules(),so
hv_sock(vsock transport) wasn't available yet.Changes
Commit 1: Move entropy init after module loading
init_entropy()afterload_all_modules()so thathv_sockis availablefor vsock-based entropy seeding.
Commit 2: Preload networking modules + logging improvements
preload_networking_modules()to load critical modules by name(
kmod_module_new_from_name) before the generalftw()-based module scan.The general scan walks by file path and may not reliably resolve all modules
on Ubuntu's directory layout.
KMOD=1in the default Makefile.load_module()andparse_tree_entry()withstructured dmesg messages including error codes.
Impact on AzLinux based kernel
No impact. On AzLinux where these modules are built-in (=y):
preload_networking_modules()callskmod_module_probe_insert_module()whichreturns immediately (KMOD_PROBE_IGNORE_LOADED).
init_entropy()still runs after modules, justin a different position in main().