From: Mike Rapoport <rppt@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
"David S. Miller" <davem@davemloft.net>
Cc: Guenter Roeck <linux@roeck-us.net>,
sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Mike Rapoport <rppt@linux.ibm.com>
Subject: Re: [PATCH] sparc32: register memory occupied by kernel as memblock.memory
Date: Wed, 27 May 2020 07:52:19 +0300 [thread overview]
Message-ID: <20200527045219.GG48741@kernel.org> (raw)
In-Reply-To: <20200524165358.27188-1-rppt@kernel.org>
Andrew, David,
Any comments on this?
On Sun, May 24, 2020 at 07:53:58PM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> sparc32 never registered the memory occupied by the kernel image with
> memblock_add() and it only reserved this memory with meblock_reserve().
>
> With openbios as system firmware, the memory occupied by the kernel is
> reserved in openbios and removed from mem.available. The prom setup code in
> the kernel uses mem.available to set up the memory banks and essentially
> there is a hole for the memory occupied by the kernel image.
>
> Later in bootmem_init() this memory is memblock_reserve()d.
>
> Up until recently, memmap initialization would call __init_single_page()
> for the pages in that hole, the free_low_memory_core_early() would mark
> them as reserved and everything would be Ok.
>
> After the change in memmap initialization introduced by the commit "mm:
> memmap_init: iterate over memblock regions rather that check each PFN", the
> hole is skipped and the page structs for it are not initialized. And when
> they are passed from memblock to page allocator as reserved, the latter
> gets confused.
>
> Simply registering the memory occupied by the kernel with memblock_add()
> resolves this issue.
>
> Tested on qemu-system-sparc with Debian Etch [1] userspace.
>
> [1] https://people.debian.org/~aurel32/qemu/sparc/debian_etch_sparc_small.qcow2
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> Link: https://lkml.kernel.org/r/20200517000050.GA87467@roeck-us.nlllllet/
> ---
>
> David,
>
> I'd really appreciate your Ack or an explanation where my analysis is wrong :)
>
> arch/sparc/mm/init_32.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
> index e45160839f79..eb2946b1df8a 100644
> --- a/arch/sparc/mm/init_32.c
> +++ b/arch/sparc/mm/init_32.c
> @@ -192,6 +192,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
> /* Reserve the kernel text/data/bss. */
> size = (start_pfn << PAGE_SHIFT) - phys_base;
> memblock_reserve(phys_base, size);
> + memblock_add(phys_base, size);
>
> size = memblock_phys_mem_size() - memblock_reserved_size();
> *pages_avail = (size >> PAGE_SHIFT) - high_pages;
> --
> 2.26.2
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2020-05-27 4:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 16:53 Mike Rapoport
2020-05-27 4:52 ` Mike Rapoport [this message]
2020-05-27 5:58 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200527045219.GG48741@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=rppt@linux.ibm.com \
--cc=sparclinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox