From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>,
linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
kernelfans@gmail.com,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Ananth Narayan <ananth@in.ibm.com>,
Nathan Fontenot <nfont@linux.vnet.ibm.com>,
Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH v3 4/7] powerpc/fadump: exclude memory holes while reserving memory in second kernel.
Date: Tue, 3 Apr 2018 15:21:52 +0530 [thread overview]
Message-ID: <04e18a87-2882-b656-8fed-800c6d0bc835@linux.vnet.ibm.com> (raw)
In-Reply-To: <152265062142.23251.2863873644423472277.stgit@jupiter.in.ibm.com>
On Monday 02 April 2018 12:00 PM, Mahesh J Salgaonkar wrote:
> From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
>
> The second kernel, during early boot after the crash, reserves rest of
> the memory above boot memory size to make sure it does not touch any of the
> dump memory area. It uses memblock_reserve() that reserves the specified
> memory region irrespective of memory holes present within that region.
> There are chances where previous kernel would have hot removed some of
> its memory leaving memory holes behind. In such cases fadump kernel reports
> incorrect number of reserved pages through arch_reserved_kernel_pages()
> hook causing kernel to hang or panic.
>
> Fix this by excluding memory holes while reserving rest of the memory
> above boot memory size during second kernel boot after crash.
>
> Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
> ---
> arch/powerpc/kernel/fadump.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 011f1aa7abab..a497e9fb93fe 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -433,6 +433,21 @@ static inline unsigned long get_fadump_metadata_base(
> return be64_to_cpu(fdm->metadata_region.source_address);
> }
>
> +static void fadump_memblock_reserve(unsigned long base, unsigned long size)
> +{
> + struct memblock_region *reg;
> + unsigned long start, end;
> +
> + for_each_memblock(memory, reg) {
> + start = max(base, (unsigned long)reg->base);
> + end = reg->base + reg->size;
> + end = min(base + size, end);
> +
> + if (start < end)
> + memblock_reserve(start, end - start);
> + }
> +}
> +
> int __init fadump_reserve_mem(void)
> {
> unsigned long base, size, memory_boundary;
> @@ -487,7 +502,7 @@ int __init fadump_reserve_mem(void)
> */
> base = fw_dump.boot_memory_size;
> size = memory_boundary - base;
> - memblock_reserve(base, size);
> + fadump_memblock_reserve(base, size);
> printk(KERN_INFO "Reserved %ldMB of memory at %ldMB "
Mahesh, you may want to change this print as well as it would be
misleading in case of
holes in the memory.
Thanks
Hari
> "for saving crash dump\n",
> (unsigned long)(size >> 20),
>
next prev parent reply other threads:[~2018-04-03 9:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 6:29 [PATCH v3 0/7] powerpc/fadump: Improvements and fixes for firmware-assisted dump Mahesh J Salgaonkar
2018-04-02 6:29 ` [PATCH v3 1/7] powerpc/fadump: Move the metadata region to start of the reserved area Mahesh J Salgaonkar
2018-04-03 19:26 ` Hari Bathini
2018-04-05 4:50 ` Mahesh Jagannath Salgaonkar
2018-04-02 6:30 ` [PATCH v3 2/7] powerpc/fadump: Update documentation to reflect the metadata region movement Mahesh J Salgaonkar
2018-04-02 6:30 ` [PATCH v3 3/7] powerpc/fadump: Reservationless firmware assisted dump Mahesh J Salgaonkar
2018-04-02 6:30 ` [PATCH v3 4/7] powerpc/fadump: exclude memory holes while reserving memory in second kernel Mahesh J Salgaonkar
2018-04-03 9:51 ` Hari Bathini [this message]
2018-04-03 11:39 ` Mahesh Jagannath Salgaonkar
2018-04-02 6:30 ` [PATCH v3 5/7] powerpc/fadump: throw proper error message on fadump registration failure Mahesh J Salgaonkar
2018-04-02 6:30 ` [PATCH v3 6/7] powerpc/fadump: Do not allow hot-remove memory from fadump reserved area Mahesh J Salgaonkar
2018-04-03 3:18 ` Pingfan Liu
2018-04-03 11:37 ` Mahesh Jagannath Salgaonkar
2018-04-02 6:30 ` [PATCH v3 7/7] powerpc/fadump: un-register fadump on kexec path Mahesh J Salgaonkar
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=04e18a87-2882-b656-8fed-800c6d0bc835@linux.vnet.ibm.com \
--to=hbathini@linux.vnet.ibm.com \
--cc=ananth@in.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=kernelfans@gmail.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=nfont@linux.vnet.ibm.com \
--cc=srikar@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).