* [PATCH] sparc32: Limit memblock allocation to low memory
@ 2021-02-04 16:20 Andreas Larsson
2021-02-04 17:19 ` Mike Rapoport
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Larsson @ 2021-02-04 16:20 UTC (permalink / raw)
To: David Miller, sparclinux
Cc: Mike Rapoport, Sam Ravnborg, linux-kernel, software
Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 changed sparc32 to use
memblocks instead of bootmem, but also made high memory available via
memblock allocation which does work together with e.g. phys_to_virt and
leads to crashes.
This changes back to only low memory being allocatable in the early
stages, now using memblock allocation.
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
arch/sparc/mm/init_32.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index eb2946b1df8a..6139c5700ccc 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -197,6 +197,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
size = memblock_phys_mem_size() - memblock_reserved_size();
*pages_avail = (size >> PAGE_SHIFT) - high_pages;
+ /* Only allow low memory to be allocated via memblock allocation */
+ memblock_set_current_limit(max_low_pfn << PAGE_SHIFT);
+
return max_pfn;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sparc32: Limit memblock allocation to low memory
2021-02-04 16:20 [PATCH] sparc32: Limit memblock allocation to low memory Andreas Larsson
@ 2021-02-04 17:19 ` Mike Rapoport
0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2021-02-04 17:19 UTC (permalink / raw)
To: Andreas Larsson
Cc: David Miller, sparclinux, Sam Ravnborg, linux-kernel, software
On Thu, Feb 04, 2021 at 05:20:53PM +0100, Andreas Larsson wrote:
> Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 changed sparc32 to use
> memblocks instead of bootmem, but also made high memory available via
> memblock allocation which does work together with e.g. phys_to_virt and
> leads to crashes.
>
> This changes back to only low memory being allocatable in the early
> stages, now using memblock allocation.
>
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> arch/sparc/mm/init_32.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
> index eb2946b1df8a..6139c5700ccc 100644
> --- a/arch/sparc/mm/init_32.c
> +++ b/arch/sparc/mm/init_32.c
> @@ -197,6 +197,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
> size = memblock_phys_mem_size() - memblock_reserved_size();
> *pages_avail = (size >> PAGE_SHIFT) - high_pages;
>
> + /* Only allow low memory to be allocated via memblock allocation */
> + memblock_set_current_limit(max_low_pfn << PAGE_SHIFT);
> +
> return max_pfn;
> }
>
> --
> 2.17.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-04 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 16:20 [PATCH] sparc32: Limit memblock allocation to low memory Andreas Larsson
2021-02-04 17:19 ` Mike Rapoport
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).