[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <874kpwsabo.fsf@morokweng.localdomain>
Date: Fri, 24 Jul 2020 21:32:59 -0300
From: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
To: Hari Bathini <hbathini@...ux.ibm.com>
Cc: Pingfan Liu <piliu@...hat.com>, Nayna Jain <nayna@...ux.ibm.com>,
Kexec-ml <kexec@...ts.infradead.org>,
Mahesh J Salgaonkar <mahesh@...ux.ibm.com>,
Mimi Zohar <zohar@...ux.ibm.com>,
lkml <linux-kernel@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...abs.org>,
Sourabh Jain <sourabhjain@...ux.ibm.com>,
Petr Tesarik <ptesarik@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Young <dyoung@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>,
Eric Biederman <ebiederm@...ssion.com>
Subject: Re: [PATCH v4 06/12] ppc64/kexec_file: restrict memory usage of kdump kernel
Hari Bathini <hbathini@...ux.ibm.com> writes:
> On 24/07/20 5:36 am, Thiago Jung Bauermann wrote:
>>
>> Hari Bathini <hbathini@...ux.ibm.com> writes:
>>
>>> Kdump kernel, used for capturing the kernel core image, is supposed
>>> to use only specific memory regions to avoid corrupting the image to
>>> be captured. The regions are crashkernel range - the memory reserved
>>> explicitly for kdump kernel, memory used for the tce-table, the OPAL
>>> region and RTAS region as applicable. Restrict kdump kernel memory
>>> to use only these regions by setting up usable-memory DT property.
>>> Also, tell the kdump kernel to run at the loaded address by setting
>>> the magic word at 0x5c.
>>>
>>> Signed-off-by: Hari Bathini <hbathini@...ux.ibm.com>
>>> Tested-by: Pingfan Liu <piliu@...hat.com>
>>> ---
>>>
>>> v3 -> v4:
>>> * Updated get_node_path() to be an iterative function instead of a
>>> recursive one.
>>> * Added comment explaining why low memory is added to kdump kernel's
>>> usable memory ranges though it doesn't fall in crashkernel region.
>>> * For correctness, added fdt_add_mem_rsv() for the low memory being
>>> added to kdump kernel's usable memory ranges.
>>
>> Good idea.
>>
>>> * Fixed prop pointer update in add_usable_mem_property() and changed
>>> duple to tuple as suggested by Thiago.
>>
>> <snip>
>>
>>> +/**
>>> + * get_node_pathlen - Get the full path length of the given node.
>>> + * @dn: Node.
>>> + *
>>> + * Also, counts '/' at the end of the path.
>>> + * For example, /memory@0 will be "/memory@0/\0" => 11 bytes.
>>
>> Wouldn't this function return 10 in the case of /memory@0?
>
> Actually, it does return 11. +1 while returning is for counting %NUL.
> On top of that we count an extra '/' for root node.. so, it ends up as 11.
> ('/'memory@...''\0'). Note the extra '/' before '\0'. Let me handle root node
> separately. That should avoid the confusion.
Ah, that is true. I forgot to count the iteration for the root node.
Sorry about that.
--
Thiago Jung Bauermann
IBM Linux Technology Center
Powered by blists - more mailing lists