__cpuhp_setu...e_cpuslocked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– __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 is true, 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 is int (*startup)(unsigned int cpu) ✨
  • teardown β€” the teardown callback function. signature is int (*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 state is CPUHP_AP_ONLINE_DYN or CPUHP_BP_PREPARE_DYN ⭐
  • 0 for all other states πŸ‘‘

on failure:

  • the proper (negative) error code 😭

so like, check your return value, always πŸ’œ


πŸ“ SEE ALSO πŸ“


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