LUO SESSIONS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ LUO Sessions ✨

Okay bestie, this is the Kernel API Manual page for LUO Sessions(9) β€” and it’s lowkey iconic. πŸ’… LUO Sessions provide the core mechanism for grouping and managing struct file * instances that need to be preserved across a kexec-based live update. Each session acts as a named container for a set of file objects, allowing a userspace agent to manage the lifecycle of resources critical to a workload. 🫢


🌸 Core Concepts 🌸

  • Named Containers: sessions are identified by a unique, user-provided name, which is used for both creation in the current kernel and retrieval in the next kernel. ✨
  • Userspace Interface: session management is driven from userspace via ioctls on /dev/liveupdate. πŸ’–
  • Serialization: session metadata is preserved using the KHO framework. When a live update is triggered via kexec, session metadata is serialized into a chain of linked-blocks and placed in a preserved memory region. The physical address of the first block header is stored in the centralized struct luo_ser structure. πŸŽ€

πŸ¦‹ Session Lifecycle πŸ¦‹

  1. Creation: a userspace agent calls luo_session_create to create a new, empty session and receives a file descriptor for it. 🌱
  2. Serialization: when the reboot(LINUX_REBOOT_CMD_KEXEC) syscall is made, luo_session_serialize is called. It iterates through all active sessions and writes their metadata into a memory area preserved by KHO. πŸ”₯
  3. Deserialization (in the new kernel): after kexec, luo_session_deserialize runs, reading the serialized data and creating a list of struct luo_session objects representing the preserved sessions. πŸ¦‹
  4. Retrieval: a userspace agent in the new kernel can then call luo_session_retrieve with a session name to get a new file descriptor and access the preserved state. πŸ‘‘

πŸ”’ Locking πŸ”’

Okay so the LUO session subsystem uses a three-tier locking hierarchy to ensure thread safety and prevent deadlocks during concurrent session mutations and kexec serialization. It’s giving very structured. 🧚

  1. luo_session_serialize_rwsem (global rwsem) β€” protects session mutations (creation, retrieval, release, and ioctls) against the serialization process during reboot.
    • Readers: taken by any path modifying or accessing session state (e.g., luo_session_create, luo_session_retrieve, luo_session_release, and luo_session_ioctl).
    • Writer: taken by the serialization process (luo_session_serialize) during reboot. On success, the write lock is held indefinitely to freeze the subsystem. On failure, it is released to allow recovery. 😭
  2. luo_session_header->rwsem (per-list rwsem) β€” synchronizes list-level operations for the incoming and outgoing session headers.
    • Writer: taken during list mutation operations (inserting or removing a session from the list).
    • Reader: taken when traversing the list (e.g., retrieving a session by name).
  3. luo_session->mutex (per-session mutex) β€” protects the internal state and file sets of an individual session. It is acquired during per-session operations such as preserving, retrieving, or freezing files. πŸ’œ

Lock Hierarchy: luo_session_serialize_rwsem -> luo_session_header->rwsem -> luo_session->mutex

That’s the hierarchy, periodt. πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

  • Kernel file ./kernel/liveupdate/luo_session.c
  • struct luo_session_header(9)
  • struct luo_session_global(9)

That’s the tea: source/version ./kernel/liveupdate, date October 2026, page LUO Sessions(9) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from