Skip to contentSkip to conversation

fixups for generic implementation of pfn_valid()

PATCH Applied Mike Rapoport 4 participants 7 messages Feb 14, 2023 – Feb 16, 2023

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

cover fixups for generic implementation of pfn_valid()

From: "Mike Rapoport (IBM)" <[email protected]>

Hi,

Guenter reported boot failures on m68k-nommu and sh caused by the switch to the generic implementation of pfn_valid():

https://lore.kernel.org/all/[email protected]
https://lore.kernel.org/all/[email protected]

These are small fixups on top of mm-stable that address the issues.

Mike Rapoport (IBM) (2):
m68k/nommu: add missing definition of ARCH_PFN_OFFSET
sh: initialize max_mapnr

 arch/m68k/include/asm/page_no.h | 2 ++
 arch/sh/mm/init.c               | 1 +
 2 files changed, 3 insertions(+)

base-commit: f67d6b26649379f8520abe6a6c7ed335310bf01e

Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/2 m68k/nommu: add missing definition of ARCH_PFN_OFFSET

From: "Mike Rapoport (IBM)" <[email protected]>

On m68k/nommu RAM does not necessarily start at 0x0 and when it does not pfn_valid() uses a wrong offset into the memory map which causes silent boot failures.

Define ARCH_PFN_OFFSET to make pfn_valid() use the correct offset.

Fixes d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
---
 arch/m68k/include/asm/page_no.h | 2 ++
 1 file changed, 2 insertions(+)
arch/m68k/include/asm/page_no.h +2 -0
index 43ff6b109ebb..060e4c0e7605 100644
@@ -28,6 +28,8 @@ extern unsigned long memory_end;
 #define	virt_addr_valid(kaddr)	(((unsigned long)(kaddr) >= PAGE_OFFSET) && \
 				((unsigned long)(kaddr) < memory_end))
 
+#define ARCH_PFN_OFFSET PHYS_PFN(PAGE_OFFSET_RAW)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _M68K_PAGE_NO_H */
Signature · 1 line
2.35.1
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET

Quoted 11 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

On m68k/nommu RAM does not necessarily start at 0x0 and when it does not pfn_valid() uses a wrong offset into the memory map which causes silent boot failures.

Define ARCH_PFN_OFFSET to make pfn_valid() use the correct offset.

Fixes d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
Quoted 17 lines
---
  arch/m68k/include/asm/page_no.h | 2 ++
  1 file changed, 2 insertions(+)
arch/m68k/include/asm/page_no.h +2 -0
index 43ff6b109ebb..060e4c0e7605 100644
@@ -28,6 +28,8 @@ extern unsigned long memory_end;
  #define	virt_addr_valid(kaddr)	(((unsigned long)(kaddr) >= PAGE_OFFSET) && \
  				((unsigned long)(kaddr) < memory_end))
 
+#define ARCH_PFN_OFFSET PHYS_PFN(PAGE_OFFSET_RAW)
+
  #endif /* __ASSEMBLY__ */
 
  #endif /* _M68K_PAGE_NO_H */
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET

In reply to Mike Rapoport
Quoted 6 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

On m68k/nommu RAM does not necessarily start at 0x0 and when it does not pfn_valid() uses a wrong offset into the memory map which causes silent boot failures.

Quoted 6 lines

Define ARCH_PFN_OFFSET to make pfn_valid() use the correct offset.

Fixes d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")

---

Signature · 3 lines
Thanks,

David / dhildenb
#4 lore raw

PATCH 2/2 sh: initialize max_mapnr

In reply to Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

sh never initializes max_mapnr which is used by the generic implementation of pfn_valid().

Initialize max_mapnr with set_max_mapnr() in sh::paging_init().

Fixes e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
---
 arch/sh/mm/init.c | 1 +
 1 file changed, 1 insertion(+)
arch/sh/mm/init.c +1 -0
index 506784702430..bf1b54055316 100644
@@ -301,6 +301,7 @@ void __init paging_init(void)
 	 */
 	max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
 	min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
+	set_max_mapnr(max_low_pfn - min_low_pfn);
 
 	nodes_clear(node_online_map);
 
Signature · 1 line
2.35.1
maintainer Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] sh: initialize max_mapnr

Quoted 19 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

sh never initializes max_mapnr which is used by the generic implementation of pfn_valid().

Initialize max_mapnr with set_max_mapnr() in sh::paging_init().

Fixes e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
---
 arch/sh/mm/init.c | 1 +
 1 file changed, 1 insertion(+)
arch/sh/mm/init.c +0 -0
index 506784702430..bf1b54055316 100644

arch/sh/mm/init.c void __init paging_init(void) · line 307

Quoted 7 lines
arch/sh/mm/init.c +1 -0
@@ -301,6 +301,7 @@ void __init paging_init(void)
 	 */
 	max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
 	min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
+	set_max_mapnr(max_low_pfn - min_low_pfn);
 
 	nodes_clear(node_online_map);
 
Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] sh: initialize max_mapnr

In reply to Mike Rapoport
Quoted 19 lines · Mike Rapoport

From: "Mike Rapoport (IBM)" <[email protected]>

sh never initializes max_mapnr which is used by the generic implementation of pfn_valid().

Initialize max_mapnr with set_max_mapnr() in sh::paging_init().

Fixes e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
---
  arch/sh/mm/init.c | 1 +
  1 file changed, 1 insertion(+)
arch/sh/mm/init.c +0 -0
index 506784702430..bf1b54055316 100644

arch/sh/mm/init.c void __init paging_init(void) · line 307

Quoted 7 lines
arch/sh/mm/init.c +1 -0
@@ -301,6 +301,7 @@ void __init paging_init(void)
  	 */
  	max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
  	min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
+	set_max_mapnr(max_low_pfn - min_low_pfn);
 
  	nodes_clear(node_online_map);
 
Signature · 3 lines
Thanks,

David / dhildenb