linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] fixups for generic implementation of pfn_valid()
@ 2023-02-14 14:07 Mike Rapoport
  2023-02-14 14:07 ` [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET Mike Rapoport
  2023-02-14 14:07 ` [PATCH 2/2] sh: initialize max_mapnr Mike Rapoport
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Rapoport @ 2023-02-14 14:07 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Greg Ungerer, Guenter Roeck,
	Mike Rapoport (IBM), Rich Felker, Yoshinori Sato, linux-kernel,
	linux-m68k, linux-mm, linux-sh

From: "Mike Rapoport (IBM)" <rppt@kernel.org>

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/20230212173513.GA4052259@roeck-us.net
https://lore.kernel.org/all/20230212161320.GA3784076@roeck-us.net

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
-- 
2.35.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET
  2023-02-14 14:07 [PATCH 0/2] fixups for generic implementation of pfn_valid() Mike Rapoport
@ 2023-02-14 14:07 ` Mike Rapoport
  2023-02-15 12:16   ` Greg Ungerer
  2023-02-16 12:55   ` David Hildenbrand
  2023-02-14 14:07 ` [PATCH 2/2] sh: initialize max_mapnr Mike Rapoport
  1 sibling, 2 replies; 7+ messages in thread
From: Mike Rapoport @ 2023-02-14 14:07 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Greg Ungerer, Guenter Roeck,
	Mike Rapoport (IBM), Rich Felker, Yoshinori Sato, linux-kernel,
	linux-m68k, linux-mm, linux-sh

From: "Mike Rapoport (IBM)" <rppt@kernel.org>

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.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
 arch/m68k/include/asm/page_no.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
index 43ff6b109ebb..060e4c0e7605 100644
--- a/arch/m68k/include/asm/page_no.h
+++ b/arch/m68k/include/asm/page_no.h
@@ -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 */
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] sh: initialize max_mapnr
  2023-02-14 14:07 [PATCH 0/2] fixups for generic implementation of pfn_valid() Mike Rapoport
  2023-02-14 14:07 ` [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET Mike Rapoport
@ 2023-02-14 14:07 ` Mike Rapoport
  2023-02-14 14:41   ` John Paul Adrian Glaubitz
  2023-02-16 12:56   ` David Hildenbrand
  1 sibling, 2 replies; 7+ messages in thread
From: Mike Rapoport @ 2023-02-14 14:07 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Greg Ungerer, Guenter Roeck,
	Mike Rapoport (IBM), Rich Felker, Yoshinori Sato, linux-kernel,
	linux-m68k, linux-mm, linux-sh

From: "Mike Rapoport (IBM)" <rppt@kernel.org>

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().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
 arch/sh/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 506784702430..bf1b54055316 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -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);
 
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] sh: initialize max_mapnr
  2023-02-14 14:07 ` [PATCH 2/2] sh: initialize max_mapnr Mike Rapoport
@ 2023-02-14 14:41   ` John Paul Adrian Glaubitz
  2023-02-16 12:56   ` David Hildenbrand
  1 sibling, 0 replies; 7+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-02-14 14:41 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Greg Ungerer, Guenter Roeck,
	Rich Felker, Yoshinori Sato, linux-kernel, linux-m68k, linux-mm,
	linux-sh

On Tue, 2023-02-14 at 16:07 +0200, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> 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().
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
>  arch/sh/mm/init.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index 506784702430..bf1b54055316 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -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);
>  

Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET
  2023-02-14 14:07 ` [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET Mike Rapoport
@ 2023-02-15 12:16   ` Greg Ungerer
  2023-02-16 12:55   ` David Hildenbrand
  1 sibling, 0 replies; 7+ messages in thread
From: Greg Ungerer @ 2023-02-15 12:16 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Guenter Roeck, Rich Felker,
	Yoshinori Sato, linux-kernel, linux-m68k, linux-mm, linux-sh


On 15/2/23 00:07, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> 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.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>

Acked-by: Greg Ungerer <gerg@linux-m68k.org>


> ---
>   arch/m68k/include/asm/page_no.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
> index 43ff6b109ebb..060e4c0e7605 100644
> --- a/arch/m68k/include/asm/page_no.h
> +++ b/arch/m68k/include/asm/page_no.h
> @@ -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 */


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET
  2023-02-14 14:07 ` [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET Mike Rapoport
  2023-02-15 12:16   ` Greg Ungerer
@ 2023-02-16 12:55   ` David Hildenbrand
  1 sibling, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2023-02-16 12:55 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Greg Ungerer, Guenter Roeck,
	Rich Felker, Yoshinori Sato, linux-kernel, linux-m68k, linux-mm,
	linux-sh

On 14.02.23 15:07, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> 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.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] sh: initialize max_mapnr
  2023-02-14 14:07 ` [PATCH 2/2] sh: initialize max_mapnr Mike Rapoport
  2023-02-14 14:41   ` John Paul Adrian Glaubitz
@ 2023-02-16 12:56   ` David Hildenbrand
  1 sibling, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2023-02-16 12:56 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton
  Cc: Arnd Bergmann, Geert Uytterhoeven, Greg Ungerer, Guenter Roeck,
	Rich Felker, Yoshinori Sato, linux-kernel, linux-m68k, linux-mm,
	linux-sh

On 14.02.23 15:07, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> 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().
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
>   arch/sh/mm/init.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index 506784702430..bf1b54055316 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -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);
>   

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-16 12:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 14:07 [PATCH 0/2] fixups for generic implementation of pfn_valid() Mike Rapoport
2023-02-14 14:07 ` [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET Mike Rapoport
2023-02-15 12:16   ` Greg Ungerer
2023-02-16 12:55   ` David Hildenbrand
2023-02-14 14:07 ` [PATCH 2/2] sh: initialize max_mapnr Mike Rapoport
2023-02-14 14:41   ` John Paul Adrian Glaubitz
2023-02-16 12:56   ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).