mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
Introduce a mechanism for managing global kernel state whose lifecycle is tied to the preservation of one or more files. This is necessary for subsystems where multiple preserved file descriptors depend on a single, shared underlying resource. An example is HugeTLB, where multiple file descriptors such as memfd and guest_memfd may rely on the state of a single HugeTLB subsystem. Preserving this state for each individual file would be redundant and incorrect. The state should be preserved only once when the first file is preserved, and restored/finished only once the last file is handled. This patch introduces File-Lifecycle-Bound (FLB) objects to solve this problem. An FLB is a global, reference-counted object with a defined set of operations: - A file handler (struct liveupdate_file_handler) declares a dependency on one or more FLBs via a new registration function, liveupdate_register_flb(). - When the first file depending on an FLB is preserved, the FLB's .preserve() callback is invoked to save the shared global state. The reference count is then incremented for each subsequent file. - Conversely, when the last file is unpreserved (before reboot) or finished (after reboot), the FLB's .unpreserve() or .finish() callback is invoked to clean up the global resource. The implementation includes: - A new set of ABI definitions (luo_flb_ser, luo_flb_head_ser) and a corresponding FDT node (luo-flb) to serialize the state of all active FLBs and pass them via Kexec Handover. - Core logic in luo_flb.c to manage FLB registration, reference counting, and the invocation of lifecycle callbacks. - An API (liveupdate_flb_get/_incoming/_outgoing) for other kernel subsystems to safely access the live object managed by an FLB, both before and after the live update. This framework provides the necessary infrastructure for more complex subsystems like IOMMU, VFIO, and KVM to integrate with the Live Update Orchestrator. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Pasha Tatashin <[email protected]> Cc: Alexander Graf <[email protected]> Cc: David Gow <[email protected]> Cc: David Matlack <[email protected]> Cc: David Rientjes <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Kees Cook <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Pratyush Yadav <[email protected]> Cc: Samiullah Khawaja <[email protected]> Cc: Tamir Duberstein <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
73 lines
1.5 KiB
ReStructuredText
73 lines
1.5 KiB
ReStructuredText
.. SPDX-License-Identifier: GPL-2.0
|
|
|
|
========================
|
|
Live Update Orchestrator
|
|
========================
|
|
:Author: Pasha Tatashin <[email protected]>
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_core.c
|
|
:doc: Live Update Orchestrator (LUO)
|
|
|
|
LUO Sessions
|
|
============
|
|
.. kernel-doc:: kernel/liveupdate/luo_session.c
|
|
:doc: LUO Sessions
|
|
|
|
LUO Preserving File Descriptors
|
|
===============================
|
|
.. kernel-doc:: kernel/liveupdate/luo_file.c
|
|
:doc: LUO File Descriptors
|
|
|
|
LUO File Lifecycle Bound Global Data
|
|
====================================
|
|
.. kernel-doc:: kernel/liveupdate/luo_flb.c
|
|
:doc: LUO File Lifecycle Bound Global Data
|
|
|
|
Live Update Orchestrator ABI
|
|
============================
|
|
.. kernel-doc:: include/linux/kho/abi/luo.h
|
|
:doc: Live Update Orchestrator ABI
|
|
|
|
The following types of file descriptors can be preserved
|
|
|
|
.. toctree::
|
|
:maxdepth: 1
|
|
|
|
../mm/memfd_preservation
|
|
|
|
Public API
|
|
==========
|
|
.. kernel-doc:: include/linux/liveupdate.h
|
|
|
|
.. kernel-doc:: include/linux/kho/abi/luo.h
|
|
:functions:
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_core.c
|
|
:export:
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_flb.c
|
|
:export:
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_file.c
|
|
:export:
|
|
|
|
Internal API
|
|
============
|
|
.. kernel-doc:: kernel/liveupdate/luo_core.c
|
|
:internal:
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_flb.c
|
|
:internal:
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_session.c
|
|
:internal:
|
|
|
|
.. kernel-doc:: kernel/liveupdate/luo_file.c
|
|
:internal:
|
|
|
|
See Also
|
|
========
|
|
|
|
- :doc:`Live Update uAPI </userspace-api/liveupdate>`
|
|
- :doc:`/core-api/kho/index`
|