powerpc/fadump: CMA init is failing
Subsystems (2)
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? [ 0.000000][ T0] cma: Failed to reserve 200 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 100 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 50 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 25 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 12 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 6 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 3 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 1 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 0 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 0 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 0 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 0 MiB
[ 0.000000][ T0] cma: pageblock_order not yet initialized. Called during early boot? [ 0.000000][ T0] cma: Failed to reserve 0 MiB
[ 0.000000][ T0] crashkernel CMA reservation failed: 200 MB requested, 0 MB reserved in 0 ranges
kernel command-line:
# cat /proc/cmdline noreboot crashkernel=200M crashkernel=200M,cma
Should be easy to reproduce it with powerpc defconfig:
make ARCH=powerpc defconfig
The crashkernel CMA init for fadump and kdump happens in:arch/powerpc/kernel/setup-common.c -> setup_arch()
initmem_init();
/*
* 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();
Has something changed for pageblock_order initialization?
- Sourabh Jain
Ritesh Harjani (IBM)
reviewerQuoted 15 lines · Sourabh Jain
I noticed CMA init for fadump crashkernel memory is failing.
[ 0.000000] cma:
pageblock_ordernot yet initialized. Called during early boot?
[ 0.000000] fadump: Failed to init cma area for firmware-assisted dump,-22kernel 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
Quoted 4 lines
Same issue with kdump CMA reservation:
[ 0.000000][ T0] cma:
pageblock_ordernot 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 ?References:
[1]: https://lore.kernel.org/linuxppc-dev/[email protected]/T/#m5adf1a845e0a0867066c4f7055f28e6304b73fa5
[2]: https://lore.kernel.org/all/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.list@gmail.com/
-ritesh
Hi Ritesh,
Quoted 65 lines · Ritesh Harjani
Quoted 15 lines · Sourabh Jain
I noticed CMA init for fadump crashkernel memory is failing.
[ 0.000000] cma:
pageblock_ordernot yet initialized. Called during early boot?
[ 0.000000] fadump: Failed to init cma area for firmware-assisted dump,-22kernel 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=3GQuoted 4 lines
Same issue with kdump CMA reservation:
[ 0.000000][ T0] cma:
pageblock_ordernot 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 thepageblock_order.Whereas earlier
set_pageblock_order()was called frominitmem_init(), just before cma reservations were being made.
start_kernel()
-setup_arch()
-initmem_init()
-sparse_init()
-set_pageblock_order(); // this sets thepageblock_order
-xxx_cma_reserve();So that means,
pageblock_orderis 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(); ... }
Quoted 7 lines
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.
Quoted 6 lines
References:
[1]: https://lore.kernel.org/linuxppc-dev/[email protected]/T/#m5adf1a845e0a0867066c4f7055f28e6304b73fa5
[2]: https://lore.kernel.org/all/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.list@gmail.com/-ritesh
Signature · 2 lines
Sincerely yours, Mike.
Ritesh Harjani (IBM)
reviewerQuoted 76 lines · Mike Rapoport
Hi Ritesh,
Quoted 65 lines · Ritesh Harjani
Quoted 15 lines · Sourabh Jain
I noticed CMA init for fadump crashkernel memory is failing.
[ 0.000000] cma:
pageblock_ordernot yet initialized. Called during early boot?
[ 0.000000] fadump: Failed to init cma area for firmware-assisted dump,-22kernel 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=3GQuoted 4 lines
Same issue with kdump CMA reservation:
[ 0.000000][ T0] cma:
pageblock_ordernot 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 thepageblock_order.Whereas earlier
set_pageblock_order()was called frominitmem_init(), just before cma reservations were being made.
start_kernel()
-setup_arch()
-initmem_init()
-sparse_init()
-set_pageblock_order(); // this sets thepageblock_order
-xxx_cma_reserve();So that means,
pageblock_orderis 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(); ... }Quoted 7 lines
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 ?
Quoted 5 lines
Unless I'm missing something these cma reservations can be moved to
arch_mm_preinit().
It runs aftermm_core_init_early()and before memblock moves the free memory to the buddy.
Right. I think, we should be able to use that...
@Sourabh,
I don't have access to the systems (travelling back...). Could you please give this a try?
arch/powerpc/kernel/setup-common.c +0 -10
@@ -35,7 +35,6 @@#include <linux/of_irq.h> #include <linux/hugetlb.h> #include <linux/pgtable.h> -#include <asm/kexec.h> #include <asm/io.h> #include <asm/paca.h> #include <asm/processor.h>
@@ -995,15 +994,6 @@ void __init setup_arch(char **cmdline_p)initmem_init (); -/* -* 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 (); -early_memtest (min_low_pfn <<PAGE_SHIFT , max_low_pfn <<PAGE_SHIFT );if (ppc_md.setup_arch)
arch/powerpc/mm/mem.c +14 -0
@@ -30,6 +30,10 @@#include <asm/setup.h> #include <asm/fixmap.h> +#include <asm/fadump.h> +#include <asm/kexec.h> +#include <asm/kvm_ppc.h> +#include <mm/mmu_decl.h> unsigned long long memory_limit__initdata ;
@@ -268,6 +272,16 @@ void __init paging_init(void)void __init arch_mm_preinit (void ) { + +/* +* Reserve large chunks of memory for use by CMA for kdump, fadump, KVM +* and hugetlb. These must be called after pageblock_order is +* initialised. +*/ +fadump_cma_init (); +kdump_cma_reserve (); +kvm_cma_reserve (); +/* * book3s is limited to 16 page sizes due to encoding this in * a 4-bit field for slices.
-ritesh
Quoted 10 lines
Quoted 6 lines
References:
[1]: https://lore.kernel.org/linuxppc-dev/[email protected]/T/#m5adf1a845e0a0867066c4f7055f28e6304b73fa5
[2]: https://lore.kernel.org/all/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.list@gmail.com/-ritesh
Signature · 2 lines
Sincerely yours, Mike.
Hello Ritesh,
Quoted 140 lines · Ritesh Harjani (IBM)
Quoted 75 lines · Mike Rapoport
Hi Ritesh,
Quoted 64 lines · Ritesh Harjani
Quoted 15 lines · Sourabh Jain
I noticed CMA init for fadump crashkernel memory is failing.
[ 0.000000] cma:
pageblock_ordernot yet initialized. Called during early boot?
[ 0.000000] fadump: Failed to init cma area for firmware-assisted dump,-22kernel 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=3GQuoted 4 lines
Same issue with kdump CMA reservation:
[ 0.000000][ T0] cma:
pageblock_ordernot 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 thepageblock_order.Whereas earlier
set_pageblock_order()was called frominitmem_init(), just before cma reservations were being made.
start_kernel()
-setup_arch()
-initmem_init()
-sparse_init()
-set_pageblock_order(); // this sets thepageblock_order
-xxx_cma_reserve();So that means,
pageblock_orderis 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(); ... }Quoted 7 lines
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 ?Quoted 5 lines
Unless I'm missing something these cma reservations can be moved to
arch_mm_preinit().
It runs aftermm_core_init_early()and before memblock moves the free memory to the buddy.Right. I think, we should be able to use that...
@Sourabh,
I don't have access to the systems (travelling back...). Could you please give this a try?
arch/powerpc/kernel/setup-common.c +0
-10@@ -35,7 +35,6 @@#include <linux/of_irq.h> #include <linux/hugetlb.h> #include <linux/pgtable.h> -#include <asm/kexec.h> #include <asm/io.h> #include <asm/paca.h> #include <asm/processor.h> @@ -995,15 +994,6 @@ void __init setup_arch(char **cmdline_p)initmem_init (); -/* -* 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 (); -early_memtest (min_low_pfn <<PAGE_SHIFT , max_low_pfn <<PAGE_SHIFT );if (ppc_md.setup_arch)arch/powerpc/mm/mem.c +7
-0@@ -30,6 +30,10 @@#include <asm/setup.h> #include <asm/fixmap.h> +#include <asm/fadump.h> +#include <asm/kexec.h> +#include <asm/kvm_ppc.h> +#include <mm/mmu_decl.h> unsigned long long memory_limit__initdata ;@@ -268,6 +272,16 @@ void __init paging_init(void)void __init arch_mm_preinit (void ) { + +/* +* Reserve large chunks of memory for use by CMA for kdump, fadump, KVM
arch/powerpc/mm/mem.c void __init paging_init(void) · line 287
Quoted 10 lines
arch/powerpc/mm/mem.c +7
-0+* and hugetlb. These must be called after pageblock_order is +* initialised. +*/ +fadump_cma_init (); +kdump_cma_reserve (); +kvm_cma_reserve (); +/* * book3s is limited to 16 page sizes due to encoding this in * a 4-bit field for slices.
The above changes fix the issue. CMA initialization now works for both kdump and fadump.
Thanks for the fix.
- Sourabh Jain
Ritesh Harjani (IBM)
reviewerQuoted 4 lines · Sourabh Jain
The above changes fix the issue. CMA initialization now works for both kdump and fadump.
Thanks Mike & Sourabh. I will soon share the fix.
-ritesh