Skip to contentSkip to conversation

m68k: mm: fix node memblock init

PATCH In review Angelo Dureghello 2 participants 4 messages Jun 14, 2020 – Jun 15, 2020 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: mm: fix node memblock init

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
index 29f47923aa46..7d04210d34f0 100644
@@ -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
#1 lore raw

Ho Angelo,

Quoted 7 lines · Angelo Dureghello

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.

The fix is correct, but it is not complete as nommu should be also fixed.
I've updated your patch with nommu fix [1].

[1] https://lore.kernel.org/lkml/[email protected]

Quoted 20 lines
---
 arch/m68k/mm/mcfmmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/mm/mcfmmu.c +1 -1
index 29f47923aa46..7d04210d34f0 100644
@@ -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
Signature · 2 lines
Sincerely yours,
Mike.
#2 lore raw

Hi Mike,

Quoted 10 lines · Mike Rapoport

Ho Angelo,

Quoted 6 lines · Angelo Dureghello

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.

Quoted 8 lines
Quoted 1 line

The fix is correct, but it is not complete as nommu should be also fixed.
I've updated your patch with nommu fix [1].

[1] https://lore.kernel.org/lkml/[email protected]

Thanks a lot !
Will try the no-mmu fix also in short.

Quoted 15 lines
Quoted 15 lines
---
 arch/m68k/mm/mcfmmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/mm/mcfmmu.c +1 -1
index 29f47923aa46..7d04210d34f0 100644
@@ -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);
 
Quoted 9 lines
Quoted 5 lines
arch/m68k/mm/mcfmmu.c +0 -1
      /* compute total pages in system */
      num_pages = PFN_DOWN(_ramend - _rambase);
--

2.26.2

--
Sincerely yours,
Mike.

Regards,
angelo

author Tested-by
#3 lore raw

Hi Mike,

tested also no-mmu on mcf5441x, i think the fix itself works. I think i am not in the recipient list of your new patch, so i leave you my tested-by for no-mmu here.

Then, i see something else wrong when mounting ext4 (sdcard). It seems to be totally unrelated,
will investigate and help as soon as i have some time.

[   15.930000] EXT4-fs (mmcblk0p2): recovery complete
[   15.940000] EXT4-fs (mmcblk0p2): mounted filesystem with ordered
data mode. Opts: (null)
[   15.950000] VFS: Mounted root (ext4 filesystem) on device 179:2.
[   15.980000] devtmpfs: mounted
[   15.990000] BUG: Bad page state in process swapper  pfn:20127
[   15.990000] page:47f804e0 refcount:0 mapcount:1 mapping:00000000 index:0x0
[   15.990000] flags: 0x0()
[   15.990000] raw: 00000000 00000100 00000122 00000000 00000000
00000000 00000000 00000000
[   15.990000] page dumped because: nonzero mapcount
[   15.990000] CPU: 0 PID: 1 Comm: swapper Not tainted
5.7.0stmark2-001-14991-ge6ff2d647c68-dirty #181
[   15.990000] Stack from 402e1ed4:
[   15.990000]         402e1ed4 40217bfa 40217bfa 4004fb4e 47f804e0
40216578 40216548 402dc2b4
[   15.990000]         00020127 ffffffff 47f804e0 4004fbcc 47f804e0
40216578 00000001 47f804e4
[   15.990000]         4005037e 47f804e0 0000020a 47f72000 ffffffff
40260000 47f804e0 47f72c10
[   15.990000]         47f72c10 47f804e0 00000000 402e1f40 402e1f40
400504f8 4024d208 00000001
[   15.990000]         47f72c04 47f804e0 401bee84 4005228a 40052b90
40050f82 47f804e0 00000000
[   15.990000]         402102d0 40052c52 47f804e0 00000000 00000000
4025cfda 400215dc 40057246
[   15.990000] Call Trace: [<4004fb4e>] bad_page+0xb4/0xd4
[   15.990000]  [<4004fbcc>] check_free_page+0x5e/0x6a
[   15.990000]  [<4005037e>] free_pcppages_bulk+0x7e/0x10c
[   15.990000]  [<400504f8>] free_unref_page_commit.isra.126+0x6e/0x7c
[   15.990000]  [<401bee84>] memset+0x0/0x80
[   15.990000]  [<4005228a>] __free_pages+0x0/0x14
[   15.990000]  [<40052b90>] adjust_managed_page_count+0x0/0x32
[   15.990000]  [<40050f82>] free_unref_page+0x46/0x50
[   15.990000]  [<40052c52>] free_reserved_area+0x90/0xcc
[   15.990000]  [<400215dc>] complete+0x0/0x2e
[   15.990000]  [<40057246>] kfree+0x0/0x138
[   15.990000]  [<401bf056>] kernel_init+0x0/0xd2
[   15.990000]  [<40002eec>] free_initmem+0x1c/0x24
[   15.990000]  [<4024e000>] set_reset_devices+0x0/0xa
[   15.990000]  [<401bf06a>] kernel_init+0x14/0xd2
[   15.990000]  [<400018c8>] ret_from_kernel_thread+0xc/0x14

I have the prompt anyway here.

Regards,
angelo

Quoted 54 lines · Angelo Dureghello

Hi Mike,

Quoted 10 lines · Mike Rapoport

Ho Angelo,

Quoted 6 lines · Angelo Dureghello

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.

Quoted 8 lines
Quoted 1 line

The fix is correct, but it is not complete as nommu should be also fixed.
I've updated your patch with nommu fix [1].

[1] https://lore.kernel.org/lkml/[email protected]

Thanks a lot !
Will try the no-mmu fix also in short.

Quoted 15 lines
Quoted 15 lines
---
 arch/m68k/mm/mcfmmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/mm/mcfmmu.c +1 -1
index 29f47923aa46..7d04210d34f0 100644
@@ -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);
 
Quoted 9 lines
Quoted 5 lines
arch/m68k/mm/mcfmmu.c +0 -1
      /* compute total pages in system */
      num_pages = PFN_DOWN(_ramend - _rambase);
--

2.26.2

--
Sincerely yours,
Mike.

Regards,
angelo

Signature · 3 lines
Angelo Dureghello
Timesys
e. [email protected]