kho_add_subtree(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« kho_add_subtree(9) πŸ’«

okay so bestie, welcome to section 9 of the Kernel API Manual, and today's main character is kho_add_subtree β€” she's the one who takes a sub blob and writes its physical address into the KHO root tree. no cap, she's iconic. πŸŽ€


✨ NAME ✨

kho_add_subtree β€” record the physical address of a sub blob in the KHO root tree. literally her whole job. πŸ’…


🌸 SYNOPSIS 🌸

int kho_add_subtree (const char *name , void *blob , size_t size );

three arguments, one int back. she keeps it cute and simple, fr fr. πŸ¦‹


πŸŽ€ ARGUMENTS πŸŽ€

  • name β€” the name of the sub tree. this is what she's gonna be called, so pick something good bestie. ✨
  • blob β€” the sub tree blob itself, the actual thing you want stored. 🫢
  • size β€” the size of the blob, measured in bytes. yes, bytes. the classic unit. πŸ’œ

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically what happens here: she creates a new child node named name inside the KHO root FDT, and she records the physical address of blob there. that's the whole vibe. πŸ“Œ

but wait β€” there's a catch, and it's giving important. the pages of blob must also be preserved by KHO, otherwise the new kernel won't be able to retrieve the blob after kexec. so don't just add the subtree and dip, okay? preserve those pages too. πŸ™ˆ

also!! when the kernel is configured with CONFIG_KEXEC_HANDOVER_DEBUGFS, a debugfs blob entry gets created for you at:

/sys/kernel/debug/kho/out/sub_fdts/name

so you can go peek at it. cute, right? πŸ”πŸ’–


⭐ RETURN ⭐

she returns 0 on success, and an error code on failure. that's it, that's the contract. πŸ”₯


🌈 SEE ALSO 🌈

the kernel file she lives in:

./kernel/liveupdate/kexec_handover.c

and her whole friend group, all in section 9:

kho_encode_radix_key(9), kho_decode_radix_key(9), kho_radix_add_key(9), kho_radix_del_key(9), kho_radix_init_tree(9), kho_radix_destroy_tree(9), kho_radix_walk_tree(9), kho_restore_folio(9), kho_restore_pages(9), kho_reserve_scratch(9), kho_preserve_folio(9), kho_unpreserve_folio(9), kho_preserve_pages(9), kho_unpreserve_pages(9), kho_preserve_vmalloc(9), kho_unpreserve_vmalloc(9), kho_restore_vmalloc(9), kho_alloc_preserve(9), kho_unpreserve_free(9), kho_restore_free(9), is_kho_boot(9), kho_retrieve_subtree(9)


ngl the whole kho_* family is a lot, but that's your reading list bestie β€” go slay it. πŸ‘‘πŸ’€

okay that's the page!! mwah πŸ’‹ this came from the source tree ./kernel/liveupdate, dated October 2026 β€” see you in the next man 9, bestie 🫢🌸

πŸ“¦ where this page comes from