Re: [PATCH] of: fdt: skip KHO when booting as crash kernel
From: Evangelos Petrongonas
Date: Thu Apr 09 2026 - 14:51:31 EST
On Thu, Apr 09, 2026 at 05:22:11PM +0300 Mike Rapoport wrote:
> Hi Evangelos,
>
> On Tue, Apr 07, 2026 at 03:06:33PM +0000, Evangelos Petrongonas wrote:
> What about x86? ;-)
>
Well... I was planning to reply with "we will sort it out in a followup".
I have a suspicion though, that you knew that the kho_fill_kimage()
approach would take care of it. Nice! Thanks for the tip.
I will post soon the v2.
> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > index 43a0944ca462..77018ec99fc8 100644
> > --- a/drivers/of/fdt.c
> > +++ b/drivers/of/fdt.c
> > @@ -926,6 +926,9 @@ static void __init early_init_dt_check_kho(void)
> > if (!IS_ENABLED(CONFIG_KEXEC_HANDOVER) || (long)node < 0)
> > return;
> >
> > + if (is_kdump_kernel())
> > + return;
> > +
>
> This seems redundant if don't add KHO nodes at the first place.
>
Indeed it is, it was more of a defense in depth in case there were stale
data somehow, but I will drop it in v2.
> > if (!of_flat_dt_get_addr_size(node, "linux,kho-fdt",
> > &fdt_start, &fdt_size))
> > return;
> > diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
> > index c4cf3552c018..b95f0b386684 100644
> > --- a/drivers/of/kexec.c
> > +++ b/drivers/of/kexec.c
> > @@ -271,7 +271,8 @@ static int kho_add_chosen(const struct kimage *image, void *fdt, int chosen_node
> > if (ret && ret != -FDT_ERR_NOTFOUND)
> > return ret;
> >
> > - if (!image->kho.fdt || !image->kho.scratch)
> > + if (!image->kho.fdt || !image->kho.scratch ||
> > + image->type == KEXEC_TYPE_CRASH)
> > return 0;
> >
> > fdt_mem = image->kho.fdt;
>
> kho_add_chosen() bails out if there's no KHO buffer in kimage, so if
> kho_fill_kimage won't add KHO buffer to kexec_crash_image it should be
> enough.
>
Indeed, one guard to rule them all. Much more elegant than the
"let's sprinkle checks everywhere (apart from x86))" approach.
> > --
> > 2.43.0
> >
> >
> >
> >
> > Amazon Web Services Development Center Germany GmbH
> > Tamara-Danz-Str. 13
> > 10243 Berlin
> > Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
> > Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
> > Sitz: Berlin
> > Ust-ID: DE 365 538 597
> >
>
> --
> Sincerely yours,
> Mike.
Kind Regards,
Evangelos
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597