[PATCH v7 00/22] Live Update Orchestrator
From: Pasha Tatashin <pasha.tatashin@soleen.com>
Date: 2025-11-22 22:23:57
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml
This series introduces the Live Update Orchestrator, a kernel subsystem designed to facilitate live kernel updates using a kexec-based reboot. This capability is critical for cloud environments, allowing hypervisors to be updated with minimal downtime for running virtual machines. LUO achieves this by preserving the state of selected resources, such as memory, devices and their dependencies, across the kernel transition. As a key feature, this series includes support for preserving memfd file descriptors, which allows critical in-memory data, such as guest RAM or any other large memory region, to be maintained in RAM across the kexec reboot. The other series that use LUO, are VFIO [1], IOMMU [2], and PCI [3] preservations. Github repo of this series [4]. The core of LUO is a framework for managing the lifecycle of preserved resources through a userspace-driven interface. Key features include: - Session Management Userspace agent (i.e. luod [5]) creates named sessions, each represented by a file descriptor (via centralized agent that controls /dev/liveupdate). The lifecycle of all preserved resources within a session is tied to this FD, ensuring automatic kernel cleanup if the controlling userspace agent crashes or exits unexpectedly. - File Preservation A handler-based framework allows specific file types (demonstrated here with memfd) to be preserved. Handlers manage the serialization, restoration, and lifecycle of their specific file types. - File-Lifecycle-Bound State A new mechanism for managing shared global state whose lifecycle is tied to the preservation of one or more files. This is crucial for subsystems like IOMMU or HugeTLB, where multiple file descriptors may depend on a single, shared underlying resource that must be preserved only once. - KHO Integration LUO drives the Kexec Handover framework programmatically to pass its serialized metadata to the next kernel. The LUO state is finalized and added to the kexec image just before the reboot is triggered. In the future this step will also be removed once stateless KHO is merged [6]. - Userspace Interface Control is provided via ioctl commands on /dev/liveupdate for creating and retrieving sessions, as well as on session file descriptors for managing individual files. - Testing The series includes a set of selftests, including userspace API validation, kexec-based lifecycle tests for various session and file scenarios, and a new in-kernel test module to validate the FLB logic. Changelog since v6 [7] - Collected Reviewed-by tags from Mike Rapoport, Pratyush Yadav, and Zhu Yanjun. Addressed all outstanding comments. - Moved ABI headers from include/linux/liveupdate/abi/ to include/linux/kho/abi/ to align with other future users of KHO and KHO itself. - Separated internal APIs to allow kernel subsystems to preserve file objects programmatically. - Introduced struct luo_file_set to manage groups of preserved files, decoupling this logic from the luo_session structure. This simplifies internal management and serialization. - Implemented luo_session_quiesce() and luo_session_resume() mechanisms. These ensure that file handlers and FLBs can be safely unregistered (liveupdate_unregister_file_handler, liveupdate_unregister_flb) by preventing new operations while unregistration is in progress. - Added a comprehensive test orchestration framework. This includes a custom init process (init.c) and scripts (luo_test.sh, run.sh) to automate kexec testing within QEMU environments across x86_64 and arm64. [1] https://lore.kernel.org/all/20251018000713.677779-1-vipinsh@google.com/ (local) [2] https://lore.kernel.org/linux-iommu/20250928190624.3735830-1-skhawaja@google.com (local) [3] https://lore.kernel.org/linux-pci/20250916-luo-pci-v2-0-c494053c3c08@kernel.org (local) [4] https://github.com/googleprodkernel/linux-liveupdate/tree/luo/v7 [5] https://tinyurl.com/luoddesign [6] https://lore.kernel.org/all/20251020100306.2709352-1-jasonmiu@google.com (local) [7] https://lore.kernel.org/all/20251115233409.768044-1-pasha.tatashin@soleen.com (local) Pasha Tatashin (16): liveupdate: luo_core: Live Update Orchestrator liveupdate: luo_core: integrate with KHO kexec: call liveupdate_reboot() before kexec liveupdate: luo_session: add sessions support liveupdate: luo_core: add user interface liveupdate: luo_file: implement file systems callbacks liveupdate: luo_session: Add ioctls for file preservation docs: add luo documentation MAINTAINERS: add liveupdate entry selftests/liveupdate: Add userspace API selftests selftests/liveupdate: Add kexec-based selftest for selftests/liveupdate: Add kexec test for multiple and empty sessions selftests/liveupdate: add test infrastructure and scripts liveupdate: luo_file: Add internal APIs for file preservation liveupdate: luo_flb: Introduce File-Lifecycle-Bound global state tests/liveupdate: Add in-kernel liveupdate test Pratyush Yadav (6): mm: shmem: use SHMEM_F_* flags instead of VM_* flags mm: shmem: allow freezing inode mapping mm: shmem: export some functions to internal.h liveupdate: luo_file: add private argument to store runtime state mm: memfd_luo: allow preserving memfd docs: add documentation for memfd preservation via LUO Documentation/core-api/index.rst | 1 + Documentation/core-api/liveupdate.rst | 71 ++ Documentation/mm/index.rst | 1 + Documentation/mm/memfd_preservation.rst | 23 + Documentation/userspace-api/index.rst | 1 + .../userspace-api/ioctl/ioctl-number.rst | 2 + Documentation/userspace-api/liveupdate.rst | 20 + MAINTAINERS | 16 + include/linux/kho/abi/luo.h | 243 +++++ include/linux/kho/abi/memfd.h | 77 ++ include/linux/liveupdate.h | 311 ++++++ include/linux/shmem_fs.h | 23 + include/uapi/linux/liveupdate.h | 216 ++++ kernel/kexec_core.c | 5 + kernel/liveupdate/Kconfig | 27 + kernel/liveupdate/Makefile | 8 + kernel/liveupdate/luo_core.c | 454 ++++++++ kernel/liveupdate/luo_file.c | 987 ++++++++++++++++++ kernel/liveupdate/luo_flb.c | 701 +++++++++++++ kernel/liveupdate/luo_internal.h | 141 +++ kernel/liveupdate/luo_session.c | 645 ++++++++++++ lib/Kconfig.debug | 23 + lib/tests/Makefile | 1 + lib/tests/liveupdate.c | 160 +++ mm/Makefile | 1 + mm/internal.h | 6 + mm/memfd_luo.c | 517 +++++++++ mm/shmem.c | 57 +- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/liveupdate/.gitignore | 9 + tools/testing/selftests/liveupdate/Makefile | 34 + tools/testing/selftests/liveupdate/config | 11 + .../testing/selftests/liveupdate/do_kexec.sh | 16 + tools/testing/selftests/liveupdate/init.c | 174 +++ .../testing/selftests/liveupdate/liveupdate.c | 348 ++++++ .../selftests/liveupdate/luo_kexec_simple.c | 89 ++ .../selftests/liveupdate/luo_multi_session.c | 162 +++ .../testing/selftests/liveupdate/luo_test.sh | 296 ++++++ .../selftests/liveupdate/luo_test_utils.c | 266 +++++ .../selftests/liveupdate/luo_test_utils.h | 44 + tools/testing/selftests/liveupdate/run.sh | 68 ++ 41 files changed, 6235 insertions(+), 21 deletions(-) create mode 100644 Documentation/core-api/liveupdate.rst create mode 100644 Documentation/mm/memfd_preservation.rst create mode 100644 Documentation/userspace-api/liveupdate.rst create mode 100644 include/linux/kho/abi/luo.h create mode 100644 include/linux/kho/abi/memfd.h create mode 100644 include/linux/liveupdate.h create mode 100644 include/uapi/linux/liveupdate.h create mode 100644 kernel/liveupdate/luo_core.c create mode 100644 kernel/liveupdate/luo_file.c create mode 100644 kernel/liveupdate/luo_flb.c create mode 100644 kernel/liveupdate/luo_internal.h create mode 100644 kernel/liveupdate/luo_session.c create mode 100644 lib/tests/liveupdate.c create mode 100644 mm/memfd_luo.c create mode 100644 tools/testing/selftests/liveupdate/.gitignore create mode 100644 tools/testing/selftests/liveupdate/Makefile create mode 100644 tools/testing/selftests/liveupdate/config create mode 100755 tools/testing/selftests/liveupdate/do_kexec.sh create mode 100644 tools/testing/selftests/liveupdate/init.c create mode 100644 tools/testing/selftests/liveupdate/liveupdate.c create mode 100644 tools/testing/selftests/liveupdate/luo_kexec_simple.c create mode 100644 tools/testing/selftests/liveupdate/luo_multi_session.c create mode 100755 tools/testing/selftests/liveupdate/luo_test.sh create mode 100644 tools/testing/selftests/liveupdate/luo_test_utils.c create mode 100644 tools/testing/selftests/liveupdate/luo_test_utils.h create mode 100755 tools/testing/selftests/liveupdate/run.sh base-commit: 2cb7e27ffe3e3e1d8a837026462ebca22cba3b4f -- 2.52.0.rc2.455.g230fcf2819-goog