Subject: Re: powerpc/fadump: CMA init is failing

From: Mike Rapoport <[email-masked]>
Date: Fri, 27 Feb 2026 22:50:24 +0200

Hi Ritesh,

On Fri, Feb 27, 2026 at 10:39:53PM +0530, Ritesh Harjani wrote:
> Sourabh Jain <[email-masked]> writes:
> 
> > I noticed CMA init for fadump crashkernel memory is failing.
> >
> > [    0.000000] cma: pageblock_order not yet initialized. Called during 
> > early boot?
> > [    0.000000] fadump: Failed to init cma area for firmware-assisted 
> > dump,-22
> >
> >
> > kernel command-line:
> > BOOT_IMAGE=(ieee1275//vdevice/v-scsi@30000070/disk@8100000000000000,msdos2)/vmlinuz-7.0.0-rc1+ 
> > root=/dev/mapper/rhel_ltcden3--lp12-root ro 
> > rd.lvm.lv=rhel_ltcden3-lp12/root rd.lvm.lv=rhel_ltcden3-lp12/swap 
> > fadump=on crashkernel=3G
> >
> >
> > Same issue with kdump CMA reservation:
> >
> > [    0.000000][    T0] cma: pageblock_order not yet initialized. Called 
> > during early boot?
> 
> Good that we added those debug prints ;)
> 
> I think I know what went wrong, as part of this arch,mm consolidation
> patch series [1], I think the order of initialization is changed.
> 
> With this patch the new order is ... 
> start_kernel()
>     - setup_arch()
>        - xxx_cma_reserve();
>     - mm_core_init_early()
>        - free_area_init()
>           - sparse_init()
>              - set_pageblock_order() // this sets the pageblock_order.
> 
> Whereas earlier set_pageblock_order() was called from initmem_init(),
> just before cma reservations were being made. 
> 
> start_kernel()
>     - setup_arch()
>        - initmem_init()
>          - sparse_init()
>            - set_pageblock_order();  // this sets the pageblock_order
>        - xxx_cma_reserve();
> 
> So that means, pageblock_order is not initialized before these cma
> reservation function calls, hence we are seeing these failures.
> 
> setup_arch() {
>     ...
> 
> 	/*
> 	 * Reserve large chunks of memory for use by CMA for kdump, fadump, KVM and
> 	 * hugetlb. These must be called after initmem_init(), so that
> 	 * pageblock_order is initialised.
> 	 */
> 	fadump_cma_init();
> 	kdump_cma_reserve();
> 	kvm_cma_reserve();
> 
>     ...
> }
> 
> 
> So what if we do.. 
> 
> start_kernel() {
>   ...
> 	setup_arch(&command_line);
> 	mm_core_init_early();
>     setup_arch_post_mm_core_init(); // and here we call CMA reservation functions ?
 
Unless I'm missing something these cma reservations can be moved to
arch_mm_preinit().
It runs after mm_core_init_early() and before memblock moves the free
memory to the buddy.

> References:
> [1]: https://lore.kernel.org/linuxppc-dev/[email-masked]/T/#m5adf1a845e0a0867066c4f7055f28e6304b73fa5
> [2]: https://lore.kernel.org/all/3ae[email-masked]/
> 
> 
> -ritesh

-- 
Sincerely yours,
Mike.