[PATCH v8 5/6] kho: kexec-metadata: track previous kernel chain

Breno Leitao leitao at debian.org
Thu Apr 9 03:13:43 PDT 2026


Hello Andrew,

On Mon, Mar 09, 2026 at 06:41:48AM -0700, Breno Leitao wrote:
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 1f22705d5d246..7bac80e9a29a4 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -1441,6 +1512,10 @@ static __init int kho_init(void)
>  	if (err)
>  		goto err_free_fdt;
>  
> +	err = kho_kexec_metadata_init(fdt);
> +	if (err)
> +		goto err_free_fdt;
> +
>  	for (int i = 0; i < kho_scratch_cnt; i++) {
>  		unsigned long base_pfn = PHYS_PFN(kho_scratch[i].addr);
>  		unsigned long count = kho_scratch[i].size >> PAGE_SHIFT;

I discovered an issue while testing this code on the current linux-next:
the kho_kexec_metadata_init() call is now unreachable due to recent
changes.

My original patch was based on commit 5c9e55fecf93658 ("Add linux-next
specific files for 20260312"), which included commit d7176a010afce8
("kho: fix deferred init of kho scratch"). However, that commit has since
been rebased/reworked in linux-next, and the code flow has changed.

I'll send a follow-up patch to correct the placement.

For reference, the intended code structure should be:

  static __init int kho_init(void) {
	  ....
          err = kho_out_fdt_setup();
          if (err)
                  goto err_free_fdt;

          err = kho_kexec_metadata_init(fdt);
          if (err)
                  goto err_free_fdt;


Currently in linux-next, it looks like:

          err = kho_out_fdt_setup();
          if (err)
                  goto err_free_fdt;

          if (fdt) {					    |
                  kho_in_debugfs_init(&kho_in.dbg, fdt);    |  -> This code was moved by d7176a010afce8, but, not anymore
                  return 0; 				    |
          }						    |

          err = kho_kexec_metadata_init(fdt);               |  -> This code is now unreachable
          if (err)
                  goto err_free_fdt;


I will send the fix for it soon, and we can carry on the discussion
there.

Thanks,
--breno




More information about the kexec mailing list