Re: [PATCH v2 1/3] kho: skip KHO data for context-preserving kexec

From: Mike Rapoport

Date: Mon May 11 2026 - 06:39:10 EST


On Wed, May 06, 2026 at 02:20:41PM -0400, Pasha Tatashin wrote:
> A preserve_context kexec returns to the current kernel, which means the
> 2nd kernel does not use KHO data (and their memory spaces don't
> overlap). Passing KHO data to the 2nd kernel via setup_data or
> devicetree is unnecessary.
>
> Add a check in kho_fill_kimage() and return early if preserve_context is
> set, to avoid passing KHO state during context-preserving kexecs.
>
> Fixes: 3bdecc3c93f9 ("kexec: add KHO support to kexec file loads")
> Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
> ---
> kernel/liveupdate/kexec_handover.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 4fde8325c49f..2eec2a169c83 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -1702,7 +1702,8 @@ int kho_fill_kimage(struct kimage *image)
> int err = 0;
> struct kexec_buf scratch;
>
> - if (!kho_enable || image->type == KEXEC_TYPE_CRASH)
> + if (!kho_enable || image->type == KEXEC_TYPE_CRASH ||
> + image->preserve_context)
> return 0;

Sashiko says it's unnecessary:

https://sashiko.dev/#/patchset/20260506182039.2623553-5-pasha.tatashin@xxxxxxxxxx

I tend to agree :)

> image->kho.fdt = virt_to_phys(kho_out.fdt);
> --
> 2.54.0.545.g6539524ca2-goog
>

--
Sincerely yours,
Mike.