Skip to content

initcall support - #82

Merged
rikvanriel merged 4 commits into
facebookexperimental:mainfrom
rikvanriel:scratch/riel/series-e-entry-points
Aug 28, 2026
Merged

initcall support#82
rikvanriel merged 4 commits into
facebookexperimental:mainfrom
rikvanriel:scratch/riel/series-e-entry-points

Conversation

@rikvanriel

Copy link
Copy Markdown
Contributor

Track initcalls of various kinds, including module_init and module_exit.

`subsys_initcall(cgwb_init)` sits inside `#ifdef CONFIG_CGROUP_WRITEBACK`, so
its statement's parent is the conditional rather than the translation unit,
and the file-scope test rejected it. Every initcall written that way was
skipped: 2,236 recorded, 2,581 after walking out through the conditional.

Assisted-by: claw:claude-opus-5
Signed-off-by: Rik van Riel <[email protected]>
Nothing in the source calls an initcall — the macro puts a pointer in a
section that do_initcalls() walks — so `callers cgwb_init` answered that no
functions call it. That is true of the source and reads as dead code, which is
the opposite of what the function is.

State the level it is filed under, and keep the source fact separate from it:

    (semcode) callers cgwb_init
    Entry point: runs at boot, filed as subsys_initcall
    Info: nothing in the source calls it

Assisted-by: claw:claude-opus-5
Signed-off-by: Rik van Riel <[email protected]>
`callers e1000_exit_module` answered that it runs at boot. A module's exit
function runs when the module is removed, and its init function runs when the
module is inserted, which is boot only for a built-in.

Both were reported the same way because every level got one sentence:

    Entry point: runs when the module is removed, filed as module_exit
    Entry point: runs when the module is inserted, or at boot if built in, filed as module_init
    Entry point: runs at boot, filed as subsys_initcall

Assisted-by: claw:claude-opus-5
Signed-off-by: Rik van Riel <[email protected]>
`__setup("init=", init_setup)` puts the handler in .init.setup, where the
command line parser finds it, and `callers init_setup` reported that nothing
calls it. Same for every kernel parameter handler and every device tree
provider: 493 CLK_OF_DECLARE, 428 __setup, 360 early_param, 183
IRQCHIP_DECLARE, 137 TIMER_OF_DECLARE.

Describe the families in one table, with the argument that names the function
and when the section is walked, and record them the way initcalls already are.
8,332 entry points recorded before, 9,940 after:

    (semcode) callers init_setup
    Entry point: runs at boot if the kernel is given that parameter, filed as __setup

    (semcode) callers of_fixed_clk_setup
    Entry point: runs when a device tree node matches, filed as CLK_OF_DECLARE

These take the function at a fixed position beside a string, so the position
is part of what is recorded; taking the first argument would record the
parameter name as a function.

There is no rule in the source that finds these on its own. The section
attribute is inside the macro definition and the name it builds is often
pasted together there, so the families are listed rather than derived.

Assisted-by: claw:claude-opus-5
Signed-off-by: Rik van Riel <[email protected]>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 28, 2026
@rikvanriel
rikvanriel merged commit 7919c2e into facebookexperimental:main Aug 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant