__cpuhp_setu...e_cpuslocked(9)
π __cpuhp_setup_state_cpuslocked(9) π
okay so bestie, welcome to the Kernel API Manual β¨ this one's a whole function, and honestly? she's kind of a big deal. let's get into it π«Ά
πΈ NAME πΈ
__cpuhp_setup_state_cpuslocked β set up the callbacks for a hotplug machine state π
like, you're literally wiring up what happens when a CPU joins or leaves the party π
β¨ SYNOPSIS β¨
int __cpuhp_setup_state_cpuslocked (enum cpuhp_state state , const char
*name , bool invoke , int (*startup)(unsigned int cpu) , int
(*teardown)(unsigned int cpu) , bool multi_instance );
she takes six arguments and returns an int, no cap π₯
π¦ ARGUMENTS π¦
stateβ the state you're setting up. that's the whole vibe check of this call πnameβ the name of the step. give her a cute label fr πinvokeβ if this istrue, the startup function gets invoked for cpus where cpu state is>= state. yes, greater-than-or-equal, don't @ me πstartupβ the startup callback function. signature isint (*startup)(unsigned int cpu)β¨teardownβ the teardown callback function. signature isint (*teardown)(unsigned int cpu)πmulti_instanceβ state is set up for multiple instances which get added afterwards. so like, more than one, added later, iykyk π¦
π DESCRIPTION π
the caller needs to hold cpus read locked while calling this function.
bestie. please. read lock. hold it. this is not optional π
that's literally the whole description and honestly it's giving "short but load-bearing" π
π RETURN π
on success:
- a positive state number if
stateisCPUHP_AP_ONLINE_DYNorCPUHP_BP_PREPARE_DYNβ 0for all other states π
on failure:
- the proper (negative) error code π
so like, check your return value, always π
π SEE ALSO π
- Kernel file
./kernel/cpu.c struct cpuhp_cpu_state(9)struct cpuhp_step(9)cpuhp_invoke_callback(9)cpuhp_ap_update_sync_state(9)cpuhp_ap_report_dead(9)cpuhp_ap_sync_alive(9)clear_tasks_mm_cpumask(9)cpu_device_down(9)notify_cpu_starting(9)cpu_device_up(9)bringup_hibernate_cpu(9)__cpuhp_remove_state_cpuslocked(9)
okay that's the whole page, go read the source bestie π§π
sign-off time: this iconic lil page lives in ./kernel, dated October 2026, and the manual name is literally __cpuhp_setu...e_cpuslocked(9) β yes the title's truncated, she's mysterious like that π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms