m68k: fixups for recent changes in memory initialization
Subsystems (2)
cover m68k: fixups for recent changes in memory initialization
From: Mike Rapoport <[email protected]>
Hi,
It's a followup to the Greg's [1] and Angelo's [2] reports of boot problems caused by the recent rework of the memory initialization.
I'm resending Angelo's original patch for mcfmmu and my fix for the nommu variant.
[1] https://lore.kernel.org/lkml/[email protected]
[2] https://lore.kernel.org/linux-m68k/[email protected]
Angelo Dureghello (1):
m68k: mm: fix node memblock init
Mike Rapoport (1):
m68k: nommu: register start of the memory with memblock
arch/m68k/kernel/setup_no.c | 3 ++- arch/m68k/mm/mcfmmu.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 m68k: nommu: register start of the memory with memblock
From: Mike Rapoport <[email protected]>
The m68k nommu setup code didn't register the beginning of the physical memory with memblock because it was anyway occupied by the kernel. However, commit fa3354e4ea39 ("mm: free_area_init: use maximal zone PFNs rather than zone sizes") changed zones initialization to use memblock.memory to detect the zone extents and this caused inconsistency between zone PFNs and the actual PFNs:
BUG: Bad page state in process swapper pfn:20165
page:41fe0ca0 refcount:0 mapcount:1 mapping:00000000 index:0x0 flags: 0x0()
raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000
page dumped because: nonzero mapcount
CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-00001-g3a38f8a60c65-dirty #1
Stack from 404c9ebc:
404c9ebc 4029ab28 4029ab28 40088470 41fe0ca0 40299e21 40299df1 404ba2a4
00020165 00000000 41fd2c10 402c7ba0 41fd2c04 40088504 41fe0ca0 40299e21
00000000 40088a12 41fe0ca0 41fe0ca4 0000020a 00000000 00000001 402ca000
00000000 41fe0ca0 41fd2c10 41fd2c10 00000000 00000000 402b2388 00000001
400a0934 40091056 404c9f44 404c9f44 40088db4 402c7ba0 00000001 41fd2c04
41fe0ca0 41fd2000 41fe0ca0 40089e02 4026ecf4 40089e4e 41fe0ca0 ffffffff
Call Trace:
[<40088470>] 0x40088470
[<40088504>] 0x40088504
[<40088a12>] 0x40088a12
[<402ca000>] 0x402ca000
[<400a0934>] 0x400a0934Adjust the memory registration with memblock to include the beginning of the physical memory and make sure that the area occupied by the kernel is marked as reserved.
--- arch/m68k/kernel/setup_no.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/m68k/kernel/setup_no.c +2 -1
@@ -138,7 +138,8 @@ void __init setup_arch(char **cmdline_p)pr_debug ("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n " , __bss_stop, memory_start, memory_start, memory_end); -memblock_add (memory_start, memory_end - memory_start); +memblock_add (_rambase, memory_end - _rambase); +memblock_reserve (_rambase, memory_start - _rambase);/* Keep a copy of command line */ *cmdline_p = &command_line[0 ];
Signature · 1 line
2.26.2
Re: [PATCH 1/2] m68k: nommu: register start of the memory with memblock
Hi Mike,
Quoted 28 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The m68k nommu setup code didn't register the beginning of the physical memory with memblock because it was anyway occupied by the kernel. However, commit
fa3354e4ea39("mm:free_area_init: use maximal zone PFNs rather than zone sizes") changed zones initialization to use memblock.memory to detect the zone extents and this caused inconsistency between zone PFNs and the actual PFNs:BUG: Bad page state in process swapper pfn:20165 page:41fe0ca0 refcount:0 mapcount:1 mapping:00000000 index:0x0 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 page dumped because: nonzero mapcount CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-00001-g3a38f8a60c65-dirty #1 Stack from 404c9ebc: 404c9ebc 4029ab28 4029ab28 40088470 41fe0ca0 40299e21 40299df1 404ba2a4 00020165 00000000 41fd2c10 402c7ba0 41fd2c04 40088504 41fe0ca0 40299e21 00000000 40088a12 41fe0ca0 41fe0ca4 0000020a 00000000 00000001 402ca000 00000000 41fe0ca0 41fd2c10 41fd2c10 00000000 00000000 402b2388 00000001 400a0934 40091056 404c9f44 404c9f44 40088db4 402c7ba0 00000001 41fd2c04 41fe0ca0 41fd2000 41fe0ca0 40089e02 4026ecf4 40089e4e 41fe0ca0 ffffffff Call Trace: [<40088470>] 0x40088470 [<40088504>] 0x40088504 [<40088a12>] 0x40088a12 [<402ca000>] 0x402ca000 [<400a0934>] 0x400a0934
Quoted 5 lines
Adjust the memory registration with memblock to include the beginning of the physical memory and make sure that the area occupied by the kernel is marked as reserved.
Signed-off-by Mike Rapoport <[email protected]>
Regards
Greg
Quoted 19 lines
--- arch/m68k/kernel/setup_no.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/m68k/kernel/setup_no.c +2
-1@@ -138,7 +138,8 @@ void __init setup_arch(char **cmdline_p)pr_debug ("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n " , __bss_stop, memory_start, memory_start, memory_end); -memblock_add (memory_start, memory_end - memory_start); +memblock_add (_rambase, memory_end - _rambase); +memblock_reserve (_rambase, memory_start - _rambase);/* Keep a copy of command line */ *cmdline_p = &command_line[0 ];
Greg Ungerer
maintainerRe: [PATCH 1/2] m68k: nommu: register start of the memory with memblock
Hi Mike,
Quoted 31 lines · Greg Ungerer
Hi Mike,
Quoted 28 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The m68k nommu setup code didn't register the beginning of the physical memory with memblock because it was anyway occupied by the kernel. However, commit
fa3354e4ea39("mm:free_area_init: use maximal zone PFNs rather than zone sizes") changed zones initialization to use memblock.memory to detect the zone extents and this caused inconsistency between zone PFNs and the actual PFNs:BUG: Bad page state in process swapper pfn:20165 page:41fe0ca0 refcount:0 mapcount:1 mapping:00000000 index:0x0 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 page dumped because: nonzero mapcount CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-00001-g3a38f8a60c65-dirty #1Stack from
404c9ebc:
404c9ebc4029ab284029ab284008847041fe0ca040299e2140299df1404ba2a400020165 0000000041fd2c10402c7ba041fd2c044008850441fe0ca040299e210000000040088a1241fe0ca041fe0ca40000020a00000000 00000001402ca0000000000041fe0ca041fd2c1041fd2c1000000000 00000000402b238800000001400a093440091056404c9f44404c9f4440088db4402c7ba00000000141fd2c0441fe0ca041fd200041fe0ca040089e024026ecf440089e4e41fe0ca0ffffffffCall Trace:[<40088470>]
0x40088470
[<40088504>]0x40088504
[<40088a12>]0x40088a12
[<402ca000>]0x402ca000
[<400a0934>]0x400a0934
Quoted 7 lines
Quoted 5 lines
Adjust the memory registration with memblock to include the beginning of the physical memory and make sure that the area occupied by the kernel is marked as reserved.
Signed-off-by Mike Rapoport <[email protected]>Acked-by Greg Ungerer <[email protected]>
What path do you anticipate this taking into mainline? I see it is still broken in 5.8-rc3.
Regards
Greg
Quoted 17 lines
Quoted 17 lines
---
arch/m68k/kernel/setup_no.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)arch/m68k/kernel/setup_no.c +2
-1@@ -138,7 +138,8 @@ void __init setup_arch(char **cmdline_p) pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ", __bss_stop, memory_start, memory_start, memory_end); - memblock_add(memory_start, memory_end - memory_start); + memblock_add(_rambase, memory_end - _rambase); + memblock_reserve(_rambase, memory_start - _rambase); /* Keep a copy of command line */ *cmdline_p = &command_line[0];
Re: [PATCH 1/2] m68k: nommu: register start of the memory with memblock
Hi Greg,
Quoted 38 lines · Greg Ungerer
Hi Mike,
Quoted 35 lines · Greg Ungerer
Hi Mike,
Quoted 32 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The m68k nommu setup code didn't register the beginning of the physical memory with memblock because it was anyway occupied by the kernel. However, commit
fa3354e4ea39("mm:free_area_init: use maximal zone PFNs rather than zone sizes") changed zones initialization to use memblock.memory to detect the zone extents and this caused inconsistency between zone PFNs and the actual PFNs:BUG: Bad page state in process swapper pfn:20165 page:41fe0ca0 refcount:0 mapcount:1 mapping:00000000 index:0x0 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 page dumped because: nonzero mapcount CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-00001-g3a38f8a60c65-dirty #1Stack from
404c9ebc:
404c9ebc4029ab284029ab284008847041fe0ca040299e2140299df1404ba2a400020165 0000000041fd2c10402c7ba041fd2c044008850441fe0ca040299e210000000040088a1241fe0ca041fe0ca40000020a00000000 00000001402ca0000000000041fe0ca041fd2c1041fd2c1000000000 00000000402b238800000001400a093440091056404c9f44404c9f4440088db4402c7ba00000000141fd2c0441fe0ca041fd200041fe0ca040089e024026ecf440089e4e41fe0ca0ffffffffCall Trace:[<40088470>]
0x40088470
[<40088504>]0x40088504
[<40088a12>]0x40088a12
[<402ca000>]0x402ca000
[<400a0934>]0x400a0934Adjust the memory registration with memblock to include the beginning of the physical memory and make sure that the area occupied by the kernel is marked as reserved.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Mike Rapoport <[email protected]>Acked-by Greg Ungerer <[email protected]>What path do you anticipate this taking into mainline? I see it is still broken in 5.8-rc3.
I thought it will go through m68k tree.
Quoted 22 lines
Regards
GregQuoted 17 lines
Quoted 17 lines
---
arch/m68k/kernel/setup_no.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)arch/m68k/kernel/setup_no.c +2
-1@@ -138,7 +138,8 @@ void __init setup_arch(char **cmdline_p) pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ", __bss_stop, memory_start, memory_start, memory_end); - memblock_add(memory_start, memory_end - memory_start); + memblock_add(_rambase, memory_end - _rambase); + memblock_reserve(_rambase, memory_start - _rambase); /* Keep a copy of command line */ *cmdline_p = &command_line[0];
Signature · 2 lines
Sincerely yours, Mike.
Greg Ungerer
maintainerRe: [PATCH 1/2] m68k: nommu: register start of the memory with memblock
Hi Mike,
Quoted 35 lines · Mike Rapoport
Quoted 34 lines · Greg Ungerer
Quoted 33 lines · Greg Ungerer
Quoted 32 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The m68k nommu setup code didn't register the beginning of the physical memory with memblock because it was anyway occupied by the kernel. However, commit
fa3354e4ea39("mm:free_area_init: use maximal zone PFNs rather than zone sizes") changed zones initialization to use memblock.memory to detect the zone extents and this caused inconsistency between zone PFNs and the actual PFNs:BUG: Bad page state in process swapper pfn:20165 page:41fe0ca0 refcount:0 mapcount:1 mapping:00000000 index:0x0 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 page dumped because: nonzero mapcount CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-00001-g3a38f8a60c65-dirty #1Stack from
404c9ebc:
404c9ebc4029ab284029ab284008847041fe0ca040299e2140299df1404ba2a400020165 0000000041fd2c10402c7ba041fd2c044008850441fe0ca040299e210000000040088a1241fe0ca041fe0ca40000020a00000000 00000001402ca0000000000041fe0ca041fd2c1041fd2c1000000000 00000000402b238800000001400a093440091056404c9f44404c9f4440088db4402c7ba00000000141fd2c0441fe0ca041fd200041fe0ca040089e024026ecf440089e4e41fe0ca0ffffffffCall Trace: [<40088470>] 0x40088470 [<40088504>] 0x40088504 [<40088a12>] 0x40088a12 [<402ca000>] 0x402ca000 [<400a0934>] 0x400a0934Adjust the memory registration with memblock to include the beginning of the physical memory and make sure that the area occupied by the kernel is marked as reserved.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Mike Rapoport <[email protected]>Acked-by Greg Ungerer <[email protected]>What path do you anticipate this taking into mainline? I see it is still broken in 5.8-rc3.
I thought it will go through m68k tree.
Ok, no worries, I will push them through.
I have pushed into the for-next and for-linus branches of the m68knommu git tree to get the ball rolling.
Regards
Greg
Quoted 18 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
--- arch/m68k/kernel/setup_no.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/m68k/kernel/setup_no.c +2
-1@@ -138,7 +138,8 @@ void __init setup_arch(char **cmdline_p) pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ", __bss_stop, memory_start, memory_start, memory_end); - memblock_add(memory_start, memory_end - memory_start); + memblock_add(_rambase, memory_end - _rambase); + memblock_reserve(_rambase, memory_start - _rambase); /* Keep a copy of command line */ *cmdline_p = &command_line[0];
PATCH 2/2 m68k: mm: fix node memblock init
In reply to Mike RapoportFrom: Angelo Dureghello <[email protected]>
After pulling 5.7.0 (linux-next merge), mcf5441x mmu boot was hanging silently.
memblock_add() seems not appropriate, since using MAX_NUMNODES as node id, while memblock_add_node() sets up memory for node id 0.
--- arch/m68k/mm/mcfmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/mm/mcfmmu.c +1 -1
@@ -174,7 +174,7 @@ void __init cf_bootmem_alloc(void) m68k_memory[0 ].addr = _rambase; m68k_memory[0 ].size = _ramend - _rambase; -memblock_add (m68k_memory[0 ].addr, m68k_memory[0 ].size); +memblock_add_node (m68k_memory[0 ].addr, m68k_memory[0 ].size,0 );/* compute total pages in system */ num_pages =PFN_DOWN (_ramend - _rambase);
Signature · 1 line
2.26.2
Re: [PATCH 2/2] m68k: mm: fix node memblock init
Hi Mike,
Quoted 10 lines · Mike Rapoport
From: Angelo Dureghello <[email protected]>
After pulling 5.7.0 (linux-next merge), mcf5441x mmu boot was hanging silently.
memblock_add()seems not appropriate, since usingMAX_NUMNODESas node id, whilememblock_add_node()sets up memory for node id 0.Signed-off-by Angelo Dureghello <[email protected]>Signed-off-by Mike Rapoport <[email protected]>
Regards
Greg
Quoted 18 lines
--- arch/m68k/mm/mcfmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/m68k/mm/mcfmmu.c +1
-1@@ -174,7 +174,7 @@ void __init cf_bootmem_alloc(void) m68k_memory[0 ].addr = _rambase; m68k_memory[0 ].size = _ramend - _rambase; -memblock_add (m68k_memory[0 ].addr, m68k_memory[0 ].size); +memblock_add_node (m68k_memory[0 ].addr, m68k_memory[0 ].size,0 );/* compute total pages in system */ num_pages =PFN_DOWN (_ramend - _rambase);