Page MenuHomeFreeBSD

init_main: Fix logging the subsystem of pre-loaded kernel modules
Needs ReviewPublic

Authored by zlei on Wed, Dec 4, 7:32 AM.
Tags
None
Referenced Files
F105044480: D47904.diff
Wed, Dec 11, 9:46 PM
Unknown Object (File)
Mon, Dec 9, 2:25 AM
Subscribers

Details

Reviewers
cperciva
Summary

A pre-loaded module may have SYSINIT that has order prior to SI_SUB_KLD,
e.g. TUNABLE_INT() / TUNABLE_LONG(). During linker_preload() those
SYSINITs are added to sysinit_list, then we can have abnormal orders,
i.e sip->subsystem < last. Without this fix the logging of current
subsystem will be wrongly melted into previous one.

MFC after: 1 week

Test Plan

Build kernel with option VERBOSE_SYSINIT, turn the knob debug.verbose_sysinit on and boot with pre-loaded kernel modules such zfs.ko.

# dmesg
...
subsystem 2000000
   usb_dev_init(0)... done.
   linker_init(0)... done.
   module_init(0)... done.
   dpcpu_startup(0)... done.
   vnet_data_startup(0)... done.
   link_elf_init(0)... done.
   link_elf_init(0)... done.
   linker_preload(0)... done.
subsystem 700000
   tunable_int_init(&__tunable_int_293)... done.
   tunable_int_init(&__tunable_int_299)... done.
   tunable_int_init(&__tunable_int_461)... done.
   tunable_int_init(&__tunable_int_467)... done.
   opensolaris_utsname_init(0)... done.
subsystem 1800000
   malloc_init(&M_CRYPTODEV)... done.
   malloc_init(&M_CXGBE)... done.
   malloc_init(&M_SOLARIS)... done.
   malloc_init(&M_KSTAT)... done.
   malloc_init(&M_TASKQ)... done.
   malloc_init(&M_ZONES)... done.
   malloc_init(&M_SFSNODES)... done.
   kmem_size_init(0)... done.
subsystem 1b00000
   sx_sysinit(&cxgbe_mlu_args)... done.
   mtx_sysinit(&zfs_debug_mtx_args)... done.
subsystem 2000000
   dbcmd_panic_add(0)... done.
   dbshow_all_procs_add(0)... done.
   dbshow_thread_add(0)... done.
   dbshow_proc_add(0)... done.
   dbshow_watches_add(0)... done.
   acpi_pm_register(0)... done.
...

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

zlei requested review of this revision.Wed, Dec 4, 7:32 AM

FIRECRACKER has option VERBOSE_SYSINIT but default off. Short circuiting as the global variable verbose_sysinit is almost constant.

zlei edited the summary of this revision. (Show Details)

Move the the logic

-       last = SI_SUB_COPYRIGHT;
+       last = SI_SUB_DUMMY;

to D47907 .