Skip to contentSkip to conversation

linux-next: boot failure after merge of the memblock tree

DISCUSSION Stephen Rothwell 3 participants 11 messages Oct 22, 2024 – Oct 29, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

mem auto-init: stack:all(zero), heap alloc:off, heap free:off

BUG: Unable to handle kernel data access on read at 0x00001878
Faulting instruction address: 0xc0000000004f00e4
Oops: Kernel access of bad area, sig: 7 [#1]
LE PAGE_SIZE=4K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.12.0-rc4-06078-g367eaba2691a #1
Hardware name: IBM pSeries (emulated by qemu) POWER10 (architected) 0x801200 0xf000006 of:SLOF,HEAD pSeries
NIP:  c0000000004f00e4 LR: c000000000489df8 CTR: 0000000000000000
REGS: c0000000028cfae0 TRAP: 0300   Not tainted  (6.12.0-rc4-06078-g367eaba2691a)
MSR:  8000000002001033 <SF,VEC,ME,IR,DR,RI,LE>  CR: 84000240  XER: 00000000
CFAR: c0000000004f2c48 DAR: 0000000000001878 DSISR: 00080000 IRQMASK: 3 

GPR00: c00000000204994c c0000000028cfd80 c0000000016a4300 c00c000000040000
GPR04: 0000000000000001 0000000000001000 0000000000000007 c000000002a11178
GPR08: 0000000000000000 0000000000001800 c00000007fffe720 0000000000002001
GPR12: 0000000000000000 c000000002a6a000 0000000000000000 00000000018855c0
GPR16: c000000002940270 c00c000000000000 0000000000040000 0000000000000000
GPR20: 0000000000000000 ffffffffffffffff 0000000000000001 ffffffffffffffff
GPR24: 00c0000000000000 0000000000000000 0000000000000000 0000000008000000
GPR28: 0000000000000000 0000000000002a6b 0000000000000000 0000000000001000 NIP [c0000000004f00e4] set_pfnblock_flags_mask+0x74/0x140
LR [c000000000489df8] reserve_bootmem_region+0x2a8/0x2c0

Call Trace:

c0000000028cfd80] [c0000000028cfdd0] 0xc0000000028cfdd0 (unreliable) c0000000028cfe20] [c00000000204994c] memblock_free_all+0x144/0x2d0 c0000000028cfea0] [c000000002016354] mem_init+0x5c/0x70 c0000000028cfec0] [c00000000204547c] mm_core_init+0x158/0x1dc c0000000028cff30] [c000000002004350] start_kernel+0x608/0x944 c0000000028cffe0] [c00000000000e99c] start_here_common+0x1c/0x20

Code: 4182000c 79082d28 7d4a4214 e9230000 3d020137 38e8ce78 79284620 792957a0 79081f24 79295d24 7d07402a 7d284a14 <e9090078> 7c254040 41800094 e9290088 
---[ end trace 0000000000000000 ]---

Kernel panic - not syncing: Attempted to kill the idle task!

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 42 lines · Stephen Rothwell <[email protected]> 于2024年10月22日周二 14:39写道:

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

mem auto-init: stack:all(zero), heap alloc:off, heap free:off

BUG: Unable to handle kernel data access on read at 0x00001878
Faulting instruction address: 0xc0000000004f00e4
Oops: Kernel access of bad area, sig: 7 [#1]
LE PAGE_SIZE=4K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.12.0-rc4-06078-g367eaba2691a #1
Hardware name: IBM pSeries (emulated by qemu) POWER10 (architected) 0x801200 0xf000006 of:SLOF,HEAD pSeries
NIP:  c0000000004f00e4 LR: c000000000489df8 CTR: 0000000000000000
REGS: c0000000028cfae0 TRAP: 0300   Not tainted  (6.12.0-rc4-06078-g367eaba2691a)
MSR:  8000000002001033 <SF,VEC,ME,IR,DR,RI,LE>  CR: 84000240  XER: 00000000
CFAR: c0000000004f2c48 DAR: 0000000000001878 DSISR: 00080000 IRQMASK: 3

GPR00: c00000000204994c c0000000028cfd80 c0000000016a4300 c00c000000040000
GPR04: 0000000000000001 0000000000001000 0000000000000007 c000000002a11178
GPR08: 0000000000000000 0000000000001800 c00000007fffe720 0000000000002001
GPR12: 0000000000000000 c000000002a6a000 0000000000000000 00000000018855c0
GPR16: c000000002940270 c00c000000000000 0000000000040000 0000000000000000
GPR20: 0000000000000000 ffffffffffffffff 0000000000000001 ffffffffffffffff
GPR24: 00c0000000000000 0000000000000000 0000000000000000 0000000008000000
GPR28: 0000000000000000 0000000000002a6b 0000000000000000 0000000000001000 NIP [c0000000004f00e4] set_pfnblock_flags_mask+0x74/0x140
LR [c000000000489df8] reserve_bootmem_region+0x2a8/0x2c0

Call Trace:

c0000000028cfd80] [c0000000028cfdd0] 0xc0000000028cfdd0 (unreliable) c0000000028cfe20] [c00000000204994c] memblock_free_all+0x144/0x2d0 c0000000028cfea0] [c000000002016354] mem_init+0x5c/0x70 c0000000028cfec0] [c00000000204547c] mm_core_init+0x158/0x1dc c0000000028cff30] [c000000002004350] start_kernel+0x608/0x944 c0000000028cffe0] [c00000000000e99c] start_here_common+0x1c/0x20

Code: 4182000c 79082d28 7d4a4214 e9230000 3d020137 38e8ce78 79284620 792957a0 79081f24 79295d24 7d07402a 7d284a14 <e9090078> 7c254040 41800094 e9290088
---[ end trace 0000000000000000 ]---

Kernel panic - not syncing: Attempted to kill the idle task!

Caused by commit

Quoted 7 lines

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

--
Cheers,
Stephen Rothwell

Thanks, I'd also like to set up the environment for testing; could you please share the command line instructions or XML files used for testing?

Sincerely yours,
Su

#2 lore raw

Hi,

Quoted 4 lines · On Wed, 23 Oct 2024 11:20:43 +0800 Su Hua <[email protected]> wrote:

Thanks, I'd also like to set up the environment for testing; could you please share the command line instructions or XML files used for testing?

Sorry for the delay. I run the following qemu command line:

qemu-system-ppc64 -M pseries -m 2G -vga none -nographic -kernel $vmlinux -initrd $initrd

where $vmlinux is the result of a PowerPC pseries_le_defconfig build and $initrd is just sufficient to get into user mode and then shutdown again. This latter is not really relevant here since we don't get to user mode.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 10 lines
Quoted 9 lines · Stephen Rothwell <[email protected]> 于2024年10月24日周四 06:23写道:

Hi,

Quoted 4 lines · On Wed, 23 Oct 2024 11:20:43 +0800 Su Hua <[email protected]> wrote:

Thanks, I'd also like to set up the environment for testing; could you please share the command line instructions or XML files used for testing?

Quoted 8 lines
Quoted 8 lines

Sorry for the delay. I run the following qemu command line:

qemu-system-ppc64 -M pseries -m 2G -vga none -nographic -kernel $vmlinux -initrd $initrd

where $vmlinux is the result of a PowerPC pseries_le_defconfig build and $initrd is just sufficient to get into user mode and then shutdown again. This latter is not really relevant here since we don't get to user mode.

Received, thank you.

Sincerely yours,
Su

maintainer
#4 lore raw
In reply to Stephen Rothwell

Hi Stephen,

Quoted 39 lines · Stephen Rothwell

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

mem auto-init: stack:all(zero), heap alloc:off, heap free:off

BUG: Unable to handle kernel data access on read at 0x00001878
Faulting instruction address: 0xc0000000004f00e4
Oops: Kernel access of bad area, sig: 7 [#1]
LE PAGE_SIZE=4K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.12.0-rc4-06078-g367eaba2691a #1
Hardware name: IBM pSeries (emulated by qemu) POWER10 (architected) 0x801200 0xf000006 of:SLOF,HEAD pSeries
NIP:  c0000000004f00e4 LR: c000000000489df8 CTR: 0000000000000000
REGS: c0000000028cfae0 TRAP: 0300   Not tainted  (6.12.0-rc4-06078-g367eaba2691a)
MSR:  8000000002001033 <SF,VEC,ME,IR,DR,RI,LE>  CR: 84000240  XER: 00000000
CFAR: c0000000004f2c48 DAR: 0000000000001878 DSISR: 00080000 IRQMASK: 3 

GPR00: c00000000204994c c0000000028cfd80 c0000000016a4300 c00c000000040000
GPR04: 0000000000000001 0000000000001000 0000000000000007 c000000002a11178
GPR08: 0000000000000000 0000000000001800 c00000007fffe720 0000000000002001
GPR12: 0000000000000000 c000000002a6a000 0000000000000000 00000000018855c0
GPR16: c000000002940270 c00c000000000000 0000000000040000 0000000000000000
GPR20: 0000000000000000 ffffffffffffffff 0000000000000001 ffffffffffffffff
GPR24: 00c0000000000000 0000000000000000 0000000000000000 0000000008000000
GPR28: 0000000000000000 0000000000002a6b 0000000000000000 0000000000001000 NIP [c0000000004f00e4] set_pfnblock_flags_mask+0x74/0x140
LR [c000000000489df8] reserve_bootmem_region+0x2a8/0x2c0

Call Trace:

c0000000028cfd80] [c0000000028cfdd0] 0xc0000000028cfdd0 (unreliable) c0000000028cfe20] [c00000000204994c] memblock_free_all+0x144/0x2d0 c0000000028cfea0] [c000000002016354] mem_init+0x5c/0x70 c0000000028cfec0] [c00000000204547c] mm_core_init+0x158/0x1dc c0000000028cff30] [c000000002004350] start_kernel+0x608/0x944 c0000000028cffe0] [c00000000000e99c] start_here_common+0x1c/0x20

Code: 4182000c 79082d28 7d4a4214 e9230000 3d020137 38e8ce78 79284620 792957a0 79081f24 79295d24 7d07402a 7d284a14 <e9090078> 7c254040 41800094 e9290088 
---[ end trace 0000000000000000 ]---

Kernel panic - not syncing: Attempted to kill the idle task!
Quoted 5 lines

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Apparently set_pfnblock_flags_mask() is unhappy when called for uninitialized struct page. With the patch below

qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL

boots up to mounting root filesystem.

mm/mm_init.c +2 -2
index 49dbd30e71ad..2395970314e7 100644
@@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
 			break;
 	}
 
+	__init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
 	if (pageblock_aligned(pfn))
 		set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
-
-	__init_single_page(pfn_to_page(pfn), pfn, zid, nid);
 }
 #else
 static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {}
Quoted 3 lines
Signature · 2 lines
Cheers,
Stephen Rothwell
Signature · 2 lines
Sincerely yours,
Mike.
#5 lore raw

Appreciate everyone.

Quoted 61 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 14:57写道:

Hi Stephen,

Quoted 39 lines · Stephen Rothwell

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

mem auto-init: stack:all(zero), heap alloc:off, heap free:off

BUG: Unable to handle kernel data access on read at 0x00001878
Faulting instruction address: 0xc0000000004f00e4
Oops: Kernel access of bad area, sig: 7 [#1]
LE PAGE_SIZE=4K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.12.0-rc4-06078-g367eaba2691a #1
Hardware name: IBM pSeries (emulated by qemu) POWER10 (architected) 0x801200 0xf000006 of:SLOF,HEAD pSeries
NIP:  c0000000004f00e4 LR: c000000000489df8 CTR: 0000000000000000
REGS: c0000000028cfae0 TRAP: 0300   Not tainted  (6.12.0-rc4-06078-g367eaba2691a)
MSR:  8000000002001033 <SF,VEC,ME,IR,DR,RI,LE>  CR: 84000240  XER: 00000000
CFAR: c0000000004f2c48 DAR: 0000000000001878 DSISR: 00080000 IRQMASK: 3

GPR00: c00000000204994c c0000000028cfd80 c0000000016a4300 c00c000000040000
GPR04: 0000000000000001 0000000000001000 0000000000000007 c000000002a11178
GPR08: 0000000000000000 0000000000001800 c00000007fffe720 0000000000002001
GPR12: 0000000000000000 c000000002a6a000 0000000000000000 00000000018855c0
GPR16: c000000002940270 c00c000000000000 0000000000040000 0000000000000000
GPR20: 0000000000000000 ffffffffffffffff 0000000000000001 ffffffffffffffff
GPR24: 00c0000000000000 0000000000000000 0000000000000000 0000000008000000
GPR28: 0000000000000000 0000000000002a6b 0000000000000000 0000000000001000 NIP [c0000000004f00e4] set_pfnblock_flags_mask+0x74/0x140
LR [c000000000489df8] reserve_bootmem_region+0x2a8/0x2c0

Call Trace:

c0000000028cfd80] [c0000000028cfdd0] 0xc0000000028cfdd0 (unreliable) c0000000028cfe20] [c00000000204994c] memblock_free_all+0x144/0x2d0 c0000000028cfea0] [c000000002016354] mem_init+0x5c/0x70 c0000000028cfec0] [c00000000204547c] mm_core_init+0x158/0x1dc c0000000028cff30] [c000000002004350] start_kernel+0x608/0x944 c0000000028cffe0] [c00000000000e99c] start_here_common+0x1c/0x20

Code: 4182000c 79082d28 7d4a4214 e9230000 3d020137 38e8ce78 79284620 792957a0 79081f24 79295d24 7d07402a 7d284a14 <e9090078> 7c254040 41800094 e9290088
---[ end trace 0000000000000000 ]---

Kernel panic - not syncing: Attempted to kill the idle task!
Quoted 5 lines

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Apparently set_pfnblock_flags_mask() is unhappy when called for uninitialized struct page. With the patch below

qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL

boots up to mounting root filesystem.

mm/mm_init.c +0 -0
index 49dbd30e71ad..2395970314e7 100644

mm/mm_init.c static void __meminit init_reserved_page(unsigned long pfn, int nid) · line 729

Quoted 9 lines
mm/mm_init.c +2 -2
@@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
                        break;
        }
 
+       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
        if (pageblock_aligned(pfn))
                set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
-
-       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);

Indeed, when #ifdef NODE_NOT_IN_PAGE_FLAGS is defined, there is no problem, and this is why my
test environment did not reveal any issues. However, when NODE_NOT_IN_PAGE_FLAGS is not defined,
page_to_nid needs to use page->flags to get the node ID, which depends on __init_single_page for initialization.

Quoted 10 lines
mm/mm_init.c +0 -0
 }
 #else
 static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {}
Quoted 4 lines

--
Cheers,
Stephen Rothwell

Quoted 3 lines

--
Sincerely yours,
Mike.

Sincerely yours,
Su

#6 lore raw
Quoted 92 lines · Su Hua <[email protected]> 于2024年10月25日周五 16:19写道:

Appreciate everyone.

Quoted 61 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 14:57写道:

Hi Stephen,

Quoted 39 lines · Stephen Rothwell

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

mem auto-init: stack:all(zero), heap alloc:off, heap free:off

BUG: Unable to handle kernel data access on read at 0x00001878
Faulting instruction address: 0xc0000000004f00e4
Oops: Kernel access of bad area, sig: 7 [#1]
LE PAGE_SIZE=4K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
Modules linked in:
CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.12.0-rc4-06078-g367eaba2691a #1
Hardware name: IBM pSeries (emulated by qemu) POWER10 (architected) 0x801200 0xf000006 of:SLOF,HEAD pSeries
NIP:  c0000000004f00e4 LR: c000000000489df8 CTR: 0000000000000000
REGS: c0000000028cfae0 TRAP: 0300   Not tainted  (6.12.0-rc4-06078-g367eaba2691a)
MSR:  8000000002001033 <SF,VEC,ME,IR,DR,RI,LE>  CR: 84000240  XER: 00000000
CFAR: c0000000004f2c48 DAR: 0000000000001878 DSISR: 00080000 IRQMASK: 3

GPR00: c00000000204994c c0000000028cfd80 c0000000016a4300 c00c000000040000
GPR04: 0000000000000001 0000000000001000 0000000000000007 c000000002a11178
GPR08: 0000000000000000 0000000000001800 c00000007fffe720 0000000000002001
GPR12: 0000000000000000 c000000002a6a000 0000000000000000 00000000018855c0
GPR16: c000000002940270 c00c000000000000 0000000000040000 0000000000000000
GPR20: 0000000000000000 ffffffffffffffff 0000000000000001 ffffffffffffffff
GPR24: 00c0000000000000 0000000000000000 0000000000000000 0000000008000000
GPR28: 0000000000000000 0000000000002a6b 0000000000000000 0000000000001000 NIP [c0000000004f00e4] set_pfnblock_flags_mask+0x74/0x140
LR [c000000000489df8] reserve_bootmem_region+0x2a8/0x2c0

Call Trace:

c0000000028cfd80] [c0000000028cfdd0] 0xc0000000028cfdd0 (unreliable) c0000000028cfe20] [c00000000204994c] memblock_free_all+0x144/0x2d0 c0000000028cfea0] [c000000002016354] mem_init+0x5c/0x70 c0000000028cfec0] [c00000000204547c] mm_core_init+0x158/0x1dc c0000000028cff30] [c000000002004350] start_kernel+0x608/0x944 c0000000028cffe0] [c00000000000e99c] start_here_common+0x1c/0x20

Code: 4182000c 79082d28 7d4a4214 e9230000 3d020137 38e8ce78 79284620 792957a0 79081f24 79295d24 7d07402a 7d284a14 <e9090078> 7c254040 41800094 e9290088
---[ end trace 0000000000000000 ]---

Kernel panic - not syncing: Attempted to kill the idle task!
Quoted 5 lines

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Apparently set_pfnblock_flags_mask() is unhappy when called for uninitialized struct page. With the patch below

qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL

boots up to mounting root filesystem.

mm/mm_init.c +0 -0
index 49dbd30e71ad..2395970314e7 100644

mm/mm_init.c static void __meminit init_reserved_page(unsigned long pfn, int nid) · line 729

Quoted 9 lines
mm/mm_init.c +2 -2
@@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
                        break;
        }
 
+       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
        if (pageblock_aligned(pfn))
                set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
-
-       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);

Indeed, when #ifdef NODE_NOT_IN_PAGE_FLAGS is defined, there is no problem, and this is why my
test environment did not reveal any issues. However, when NODE_NOT_IN_PAGE_FLAGS is not defined,
page_to_nid needs to use page->flags to get the node ID, which depends on __init_single_page for initialization.

Quoted 10 lines
mm/mm_init.c +0 -0
 }
 #else
 static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {}
Quoted 4 lines

--
Cheers,
Stephen Rothwell

Quoted 6 lines
Quoted 3 lines

--
Sincerely yours,
Mike.

Sincerely yours,
Su

Hi Mike
Could you please advise whether the fix for this issue should be submitted by you or me
as a new patch, or should I submit a patch that adjusts the code position, just like this:

mm/mm_init.c +0 -0
index 4ba5607aaf19..5a8114fb02ae 100644
@@ -723,6 +723,9 @@ static void __meminit init_reserved_page(unsigned

long pfn, int nid)

                        break;
        }
        __init_single_page(pfn_to_page(pfn), pfn, zid, nid);

+
+ if (pageblock_aligned(pfn))
+ set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
}
#else

Sincerely yours,
Su

maintainer
#7 lore raw
Quoted 51 lines · Su Hua
Quoted 36 lines · Su Hua <[email protected]> 于2024年10月25日周五 16:19写道:

Appreciate everyone.

Quoted 32 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 14:57写道:

Hi Stephen,

Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

Quoted 7 lines
Kernel panic - not syncing: Attempted to kill the idle task!

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Apparently set_pfnblock_flags_mask() is unhappy when called for uninitialized struct page. With the patch below

qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL

boots up to mounting root filesystem.

mm/mm_init.c +0 -0
index 49dbd30e71ad..2395970314e7 100644
@@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
                        break;
        }
 
Quoted 13 lines

mm/mm_init.c static void __meminit init_reserved_page(unsigned long pfn, int nid) · line 729

Quoted 6 lines
mm/mm_init.c +2 -2
+       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
        if (pageblock_aligned(pfn))
                set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
-
-       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);

Indeed, when #ifdef NODE_NOT_IN_PAGE_FLAGS is defined, there is no problem, and this is why my
test environment did not reveal any issues. However, when NODE_NOT_IN_PAGE_FLAGS is not defined,
page_to_nid needs to use page->flags to get the node ID, which depends on __init_single_page for initialization.

Quoted 5 lines

Hi Mike
Could you please advise whether the fix for this issue should be submitted by you or me
as a new patch, or should I submit a patch that adjusts the code position, just like this:

I've folded the update into your original commit, it's now in for-next branch of memblock tree

Quoted 17 lines
mm/mm_init.c +3 -0
index 4ba5607aaf19..5a8114fb02ae 100644
@@ -723,6 +723,9 @@ static void __meminit init_reserved_page(unsigned
 long pfn, int nid)
                        break;
        }
        __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
+       if (pageblock_aligned(pfn))
+               set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
 }
 #else

Sincerely yours,
Su

Signature · 2 lines
Sincerely yours,
Mike.
#8 lore raw
Quoted 53 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 16:46写道:
Quoted 51 lines · Su Hua
Quoted 49 lines · Su Hua <[email protected]> 于2024年10月25日周五 16:19写道:

Appreciate everyone.

Quoted 29 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 14:57写道:

Hi Stephen,

Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

Quoted 7 lines
Kernel panic - not syncing: Attempted to kill the idle task!

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Apparently set_pfnblock_flags_mask() is unhappy when called for uninitialized struct page. With the patch below

qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL

boots up to mounting root filesystem.

mm/mm_init.c +0 -0
index 49dbd30e71ad..2395970314e7 100644

mm/mm_init.c static void __meminit init_reserved_page(unsigned long pfn, int nid) · line 729

Quoted 9 lines
mm/mm_init.c +2 -2
@@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
                        break;
        }
 
+       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
        if (pageblock_aligned(pfn))
                set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
-
-       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);

Indeed, when #ifdef NODE_NOT_IN_PAGE_FLAGS is defined, there is no problem, and this is why my
test environment did not reveal any issues. However, when NODE_NOT_IN_PAGE_FLAGS is not defined,
page_to_nid needs to use page->flags to get the node ID, which depends on __init_single_page for initialization.

Quoted 8 lines
Quoted 5 lines

Hi Mike
Could you please advise whether the fix for this issue should be submitted by you or me
as a new patch, or should I submit a patch that adjusts the code position, just like this:

I've folded the update into your original commit, it's now in for-next branch of memblock tree

Okay, thank you.

Quoted 21 lines
Quoted 15 lines
mm/mm_init.c +3 -0
index 4ba5607aaf19..5a8114fb02ae 100644
@@ -723,6 +723,9 @@ static void __meminit init_reserved_page(unsigned
 long pfn, int nid)
                        break;
        }
        __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
+       if (pageblock_aligned(pfn))
+               set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
 }
 #else
Quoted 2 lines

Sincerely yours,
Su

--
Sincerely yours,
Mike.

#9 lore raw

Hi all,

Quoted 66 lines · On Sat, 26 Oct 2024 07:36:13 +0800 Su Hua <[email protected]> wrote:
Quoted 53 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 16:46写道:
Quoted 51 lines · Su Hua
Quoted 49 lines · Su Hua <[email protected]> 于2024年10月25日周五 16:19写道:

Appreciate everyone.

Quoted 29 lines · Mike Rapoport <[email protected]> 于2024年10月25日周五 14:57写道:

Hi Stephen,

Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the memblock tree, today's linux-next build (powerpc_pseries_le_defconfig) failed my qemu boot test like this:

Quoted 7 lines
Kernel panic - not syncing: Attempted to kill the idle task!

Caused by commit

ad48825232a9 ("memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE")

I bisected the failure to this commit and have reverted it for today.

Apparently set_pfnblock_flags_mask() is unhappy when called for uninitialized struct page. With the patch below

qemu-system-ppc64el -M pseries -cpu power10 -smp 16 -m 32G -vga none -nographic -kernel $KERNEL

boots up to mounting root filesystem.

mm/mm_init.c +0 -0
index 49dbd30e71ad..2395970314e7 100644

mm/mm_init.c static void __meminit init_reserved_page(unsigned long pfn, int nid) · line 729

Quoted 9 lines
mm/mm_init.c +2 -2
@@ -723,10 +723,10 @@ static void __meminit init_reserved_page(unsigned long pfn, int nid)
                        break;
        }
 
+       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
        if (pageblock_aligned(pfn))
                set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
-
-       __init_single_page(pfn_to_page(pfn), pfn, zid, nid);  

Indeed, when #ifdef NODE_NOT_IN_PAGE_FLAGS is defined, there is no problem, and this is why my
test environment did not reveal any issues. However, when NODE_NOT_IN_PAGE_FLAGS is not defined,
page_to_nid needs to use page->flags to get the node ID, which depends on __init_single_page for initialization.

Quoted 8 lines
Quoted 5 lines

Hi Mike
Could you please advise whether the fix for this issue should be submitted by you or me
as a new patch, or should I submit a patch that adjusts the code position, just like this:

I've folded the update into your original commit, it's now in for-next branch of memblock tree

Okay, thank you.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
mm/mm_init.c +0 -0
index 4ba5607aaf19..5a8114fb02ae 100644
@@ -723,6 +723,9 @@ static void __meminit init_reserved_page(unsigned
 long pfn, int nid)
Quoted 8 lines

mm/mm_init.c static void __meminit init_reserved_page(unsigned · line 731

Quoted 8 lines
mm/mm_init.c +3 -0
                        break;
        }
        __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
+       if (pageblock_aligned(pfn))
+               set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
 }
 #else

This has returned, so I applied by hand the above discussed fix.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#10 lore raw
Quoted 4 lines · Stephen Rothwell

Hi all,

Quoted 1 line · On Sat, 26 Oct 2024 07:36:13 +0800 Su Hua <[email protected]> wrote:
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
mm/mm_init.c +0 -0
index 4ba5607aaf19..5a8114fb02ae 100644
@@ -723,6 +723,9 @@ static void __meminit init_reserved_page(unsigned
 long pfn, int nid)
Quoted 8 lines
Quoted 8 lines

mm/mm_init.c static void __meminit init_reserved_page(unsigned · line 731

Quoted 8 lines
mm/mm_init.c +3 -0
                        break;
        }
        __init_single_page(pfn_to_page(pfn), pfn, zid, nid);
+
+       if (pageblock_aligned(pfn))
+               set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVABLE);
 }
 #else

This has returned, so I applied by hand the above discussed fix.

Sorry, I forgot to push :/

Quoted 3 lines
Signature · 2 lines
Cheers,
Stephen Rothwell
Signature · 2 lines
Sincerely yours,
Mike.