LUO SESSIONS(9)
β¨ 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_serstructure. π
π¦ Session Lifecycle π¦
- Creation: a userspace agent calls
luo_session_createto create a new, empty session and receives a file descriptor for it. π± - Serialization: when the
reboot(LINUX_REBOOT_CMD_KEXEC)syscall is made,luo_session_serializeis called. It iterates through all active sessions and writes their metadata into a memory area preserved by KHO. π₯ - Deserialization (in the new kernel): after kexec,
luo_session_deserializeruns, reading the serialized data and creating a list ofstruct luo_sessionobjects representing the preserved sessions. π¦ - Retrieval: a userspace agent in the new kernel can then call
luo_session_retrievewith 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. π§
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, andluo_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. π
- Readers: taken by any path modifying or accessing session state (e.g.,
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).
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
- 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