From: Michael Ellerman <mpe@ellerman.id.au>
To: Hari Bathini <hbathini@linux.vnet.ibm.com>,
Mahesh Jagannath Salgaonkar <mahesh@linux.vnet.ibm.com>,
Hari Bathini <hbathini@linux.ibm.com>
Cc: stable@vger.kernel.org, linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] powerpc/fadump: handle crash memory ranges array overflow
Date: Mon, 06 Aug 2018 18:13:56 +1000 [thread overview]
Message-ID: <87effboqt7.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <a552618a-64e0-6c54-29cd-7d8b49093350@linux.vnet.ibm.com>
Hari Bathini <hbathini@linux.vnet.ibm.com> writes:
> On Monday 06 August 2018 09:52 AM, Mahesh Jagannath Salgaonkar wrote:
>> On 07/31/2018 07:26 PM, Hari Bathini wrote:
>>> Crash memory ranges is an array of memory ranges of the crashing kernel
>>> to be exported as a dump via /proc/vmcore file. The size of the array
>>> is set based on INIT_MEMBLOCK_REGIONS, which works alright in most cases
>>> where memblock memory regions count is less than INIT_MEMBLOCK_REGIONS
>>> value. But this count can grow beyond INIT_MEMBLOCK_REGIONS value since
>>> commit 142b45a72e22 ("memblock: Add array resizing support").
>>>
...
>>>
>>> Fixes: 2df173d9e85d ("fadump: Initialize elfcore header and add PT_LOAD program headers.")
>>> Cc: stable@vger.kernel.org
>>> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
>>> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
>>> ---
>>> arch/powerpc/include/asm/fadump.h | 2 +
>>> arch/powerpc/kernel/fadump.c | 63 ++++++++++++++++++++++++++++++++++---
>>> 2 files changed, 59 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h
>>> index 5a23010..ff708b3 100644
>>> --- a/arch/powerpc/include/asm/fadump.h
>>> +++ b/arch/powerpc/include/asm/fadump.h
>>> @@ -196,7 +196,7 @@ struct fadump_crash_info_header {
>>> };
>>>
>>> /* Crash memory ranges */
>>> -#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2)
>>> +#define INIT_CRASHMEM_RANGES INIT_MEMBLOCK_REGIONS
>>>
>>> struct fad_crash_memory_ranges {
>>> unsigned long long base;
>>> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
>>> index 07e8396..1c1df4f 100644
>>> --- a/arch/powerpc/kernel/fadump.c
>>> +++ b/arch/powerpc/kernel/fadump.c
...
>
>> Also alongwith this change, Should we also double the initial array size
>> (e.g. INIT_CRASHMEM_RANGES * 2) to reduce our chances to go for memory
>> allocation ?
>
> Agreed that doubling the static array size reduces the likelihood of the
> need for
> dynamic array resizing. Will do that.
>
> Nonetheless, if we get to the point where 2K memory allocation fails on
> a system with so many memory ranges, it is likely that the kernel has some basic
> problems to deal with first :)
Yes, this all seems a bit silly.
Why not just allocate a 64K page and be done with it?
AFAICS we're not being called too early to do that, and if you can't
allocate a single page then the system is going to OOM anyway.
cheers
prev parent reply other threads:[~2018-08-06 10:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 13:56 [PATCH] powerpc/fadump: handle crash memory ranges array overflow Hari Bathini
2018-08-06 4:22 ` Mahesh Jagannath Salgaonkar
2018-08-06 5:35 ` Hari Bathini
2018-08-06 8:13 ` Michael Ellerman [this message]
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=87effboqt7.fsf@concordia.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=hbathini@linux.ibm.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=stable@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