2023-02-14 14:09:33

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 0/2] 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
--
2.35.1



2023-02-14 14:10:12

by Mike Rapoport

[permalink] [raw]
Subject: [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.

Reported-by: Guenter Roeck <[email protected]>
Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
Signed-off-by: Mike Rapoport (IBM) <[email protected]>
---
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


2023-02-14 14:14:36

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 2/2] sh: initialize max_mapnr

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

Reported-by: Guenter Roeck <[email protected]>
Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
Signed-off-by: Mike Rapoport (IBM) <[email protected]>
---
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


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

On Tue, 2023-02-14 at 16:07 +0200, Mike Rapoport wrote:
> 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().
>
> Reported-by: Guenter Roeck <[email protected]>
> Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
> Signed-off-by: Mike Rapoport (IBM) <[email protected]>
> ---
> 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 <[email protected]>

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

2023-02-15 12:16:43

by Greg Ungerer

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


On 15/2/23 00:07, Mike Rapoport wrote:
> 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.
>
> Reported-by: Guenter Roeck <[email protected]>
> Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
> Signed-off-by: Mike Rapoport (IBM) <[email protected]>

Acked-by: Greg Ungerer <[email protected]>


> ---
> 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 */

2023-02-16 12:56:40

by David Hildenbrand

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

On 14.02.23 15:07, Mike Rapoport wrote:
> 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.
>
> Reported-by: Guenter Roeck <[email protected]>
> Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU")
> Signed-off-by: Mike Rapoport (IBM) <[email protected]>
> ---

Reviewed-by: David Hildenbrand <[email protected]>

--
Thanks,

David / dhildenb


2023-02-16 12:57:12

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH 2/2] sh: initialize max_mapnr

On 14.02.23 15:07, Mike Rapoport wrote:
> 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().
>
> Reported-by: Guenter Roeck <[email protected]>
> Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
> Signed-off-by: Mike Rapoport (IBM) <[email protected]>
> ---
> 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 <[email protected]>

--
Thanks,

David / dhildenb