[PATCH v7 0/2] Make KHO Stateless

Jason Miu posted 2 patches 3 weeks, 1 day ago
There is a newer version of this series
Documentation/admin-guide/mm/kho.rst        |  53 +-
Documentation/core-api/kho/abi.rst          |   6 +
Documentation/core-api/kho/index.rst        |  18 +-
include/linux/kho/abi/kexec_handover.h      | 144 +++-
include/linux/kho_radix_tree.h              |  70 ++
kernel/liveupdate/kexec_handover.c          | 695 ++++++++++----------
kernel/liveupdate/kexec_handover_debugfs.c  |  23 -
kernel/liveupdate/kexec_handover_internal.h |   3 -
kernel/liveupdate/luo_core.c                |  12 +-
kernel/liveupdate/luo_flb.c                 |   2 +-
tools/testing/selftests/kho/init.c          |  20 -
11 files changed, 573 insertions(+), 473 deletions(-)
create mode 100644 include/linux/kho_radix_tree.h
[PATCH v7 0/2] Make KHO Stateless
Posted by Jason Miu 3 weeks, 1 day ago
This series transitions KHO from an xarray-based metadata tracking system
with serialization to a radix tree data structure that can be passed
directly to the next kernel.

The key motivations for this change are to:
- Eliminate the need for data serialization before kexec.
- Remove the KHO finalize state.
- Pass preservation metadata more directly to the next kernel via the FDT.

The new approach uses a radix tree to mark preserved pages. A page's
physical address and its order are encoded into a single value. The tree
is composed of multiple levels of page-sized tables, with leaf nodes
being bitmaps where each set bit represents a preserved page. The
physical address of the radix tree's root is passed in the FDT, allowing
the next kernel to reconstruct the preserved memory map.

This series is broken down into the following patches:

1.  kho: Adopt radix tree for preserved memory tracking:    
    Replaces the xarray-based tracker with the new radix tree
    implementation and increments the ABI version.

2.  kho: Remove finalize state and clients:
    Removes the now-obsolete kho_finalize() function and its usage
    from client code and debugfs.

---

Changelog since v6 [1]:
- Fixed a potential dangling pointer in kho_radix_add_page() on allocation failure
- Fixed a premature return in __kho_radix_walk_tree()
- Corrected the size type in kho_preserved_memory_reserve() to match memblock_reserve()

[1] https://lore.kernel.org/lkml/20260115230047.1220580-1-jasonmiu@google.com/

---

Jason Miu (2):
  kho: Adopt radix tree for preserved memory tracking
  kho: Remove finalize state and clients

 Documentation/admin-guide/mm/kho.rst        |  53 +-
 Documentation/core-api/kho/abi.rst          |   6 +
 Documentation/core-api/kho/index.rst        |  18 +-
 include/linux/kho/abi/kexec_handover.h      | 144 +++-
 include/linux/kho_radix_tree.h              |  70 ++
 kernel/liveupdate/kexec_handover.c          | 695 ++++++++++----------
 kernel/liveupdate/kexec_handover_debugfs.c  |  23 -
 kernel/liveupdate/kexec_handover_internal.h |   3 -
 kernel/liveupdate/luo_core.c                |  12 +-
 kernel/liveupdate/luo_flb.c                 |   2 +-
 tools/testing/selftests/kho/init.c          |  20 -
 11 files changed, 573 insertions(+), 473 deletions(-)
 create mode 100644 include/linux/kho_radix_tree.h


base-commit: 9b7977f9e39b7768c70c2aa497f04e7569fd3e00
-- 
2.52.0.457.g6b5491de43-goog
Re: [PATCH v7 0/2] Make KHO Stateless
Posted by Mike Rapoport 2 weeks, 4 days ago
Hi Jason,

On Thu, Jan 15, 2026 at 07:44:30PM -0800, Jason Miu wrote:
> This series transitions KHO from an xarray-based metadata tracking system
> with serialization to a radix tree data structure that can be passed
> directly to the next kernel.
> 
> The key motivations for this change are to:
> - Eliminate the need for data serialization before kexec.
> - Remove the KHO finalize state.
> - Pass preservation metadata more directly to the next kernel via the FDT.
> 
> The new approach uses a radix tree to mark preserved pages. A page's
> physical address and its order are encoded into a single value. The tree
> is composed of multiple levels of page-sized tables, with leaf nodes
> being bitmaps where each set bit represents a preserved page. The
> physical address of the radix tree's root is passed in the FDT, allowing
> the next kernel to reconstruct the preserved memory map.
> 
> This series is broken down into the following patches:
> 
> 1.  kho: Adopt radix tree for preserved memory tracking:    
>     Replaces the xarray-based tracker with the new radix tree
>     implementation and increments the ABI version.
> 
> 2.  kho: Remove finalize state and clients:
>     Removes the now-obsolete kho_finalize() function and its usage
>     from client code and debugfs.
> 
> ---
> 
> Changelog since v6 [1]:
> - Fixed a potential dangling pointer in kho_radix_add_page() on allocation failure
> - Fixed a premature return in __kho_radix_walk_tree()
> - Corrected the size type in kho_preserved_memory_reserve() to match memblock_reserve()

git range-diff claims that v5, v6 and v7 are identical.

Can you please verify that it's the latest version you intended to send?
 
> [1] https://lore.kernel.org/lkml/20260115230047.1220580-1-jasonmiu@google.com/
> 
> ---
> 
> Jason Miu (2):
>   kho: Adopt radix tree for preserved memory tracking
>   kho: Remove finalize state and clients
> 
>  Documentation/admin-guide/mm/kho.rst        |  53 +-
>  Documentation/core-api/kho/abi.rst          |   6 +
>  Documentation/core-api/kho/index.rst        |  18 +-
>  include/linux/kho/abi/kexec_handover.h      | 144 +++-
>  include/linux/kho_radix_tree.h              |  70 ++
>  kernel/liveupdate/kexec_handover.c          | 695 ++++++++++----------
>  kernel/liveupdate/kexec_handover_debugfs.c  |  23 -
>  kernel/liveupdate/kexec_handover_internal.h |   3 -
>  kernel/liveupdate/luo_core.c                |  12 +-
>  kernel/liveupdate/luo_flb.c                 |   2 +-
>  tools/testing/selftests/kho/init.c          |  20 -
>  11 files changed, 573 insertions(+), 473 deletions(-)
>  create mode 100644 include/linux/kho_radix_tree.h
> 
> 
> base-commit: 9b7977f9e39b7768c70c2aa497f04e7569fd3e00
> -- 
> 2.52.0.457.g6b5491de43-goog
> 

-- 
Sincerely yours,
Mike.