On Sat, Nov 15 2025, Mike Rapoport wrote:

> On Fri, Nov 14, 2025 at 05:52:37PM +0100, Pratyush Yadav wrote:
>> On Fri, Nov 14 2025, Pasha Tatashin wrote:
>> 
>> > @@ -1377,16 +1387,12 @@ static void __init kho_release_scratch(void)
>> >  
>> >  void __init kho_memory_init(void)
>> >  {
>> > -  struct folio *folio;
>> > -
>> >    if (kho_in.scratch_phys) {
>> >            kho_scratch = phys_to_virt(kho_in.scratch_phys);
>> >            kho_release_scratch();
>> >  
>> > -          kho_mem_deserialize(kho_get_fdt());
>> > -          folio = kho_restore_folio(kho_in.fdt_phys);
>> > -          if (!folio)
>> > -                  pr_warn("failed to restore folio for KHO fdt\n");
>> > +          if (!kho_mem_deserialize(kho_get_fdt()))
>> > +                  kho_in.fdt_phys = 0;
>> 
>> The folio restore does serve a purpose: it accounts for that folio in
>> the system's total memory. See the call to adjust_managed_page_count()
>> in kho_restore_page(). In practice, I don't think it makes much of a
>> difference, but I don't see why not.
>
> This page is never freed, so adding it to zone managed pages or keeping it
> reserved does not change anything.

In practice, sure. I still don't see a good reason to _not_ initialize
the page properly. It's not like it costs us much in terms of
performance or code complexity.

Since kho_restore_folio() makes sure the folio was _actually_ preserved
from KHO, you have a safety check against previous kernel having a bug
and not preserving the FDT properly. And I get that the FDT has already
been used by this point, but at least you would have some known point to
catch this.

[...]

-- 
Regards,
Pratyush Yadav

Reply via email to