lkml.org 
[lkml]   [2018]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v10 03/14] powerpc, kexec_file: factor out memblock-based arch_kexec_walk_mem()
From
Date
Hi Akashi,

On 09/07/18 06:49, AKASHI Takahiro wrote:
> On Tue, Jul 03, 2018 at 05:36:24PM +0100, James Morse wrote:
>> On 23/06/18 03:20, AKASHI Takahiro wrote:
>>> Memblock list is another source for usable system memory layout.
>>> A merged new arch_kexec_walk_mem() will walk through either io resource
>>> list or memblock list depending on CONFIG_ARCH_DISCARD_MEMBLOCK so that
>>> arm64, in addition to powerpc, will be able to utilize this generic
>>> function for kexec_file.
>>
>>> diff --git a/arch/powerpc/kernel/machine_kexec_file_64.c b/arch/powerpc/kernel/machine_kexec_file_64.c
>>> index 0bd23dc789a4..3d4be91786ce 100644
>>> --- a/arch/powerpc/kernel/machine_kexec_file_64.c
>>> +++ b/arch/powerpc/kernel/machine_kexec_file_64.c

>>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>>> index 63c7ce1c0c3e..563acd1c9a61 100644
>>> --- a/kernel/kexec_file.c
>>> +++ b/kernel/kexec_file.c
>>> @@ -16,6 +16,7 @@
>>> #include <linux/file.h>
>>> #include <linux/slab.h>
>>> #include <linux/kexec.h>
>>> +#include <linux/memblock.h>
>>> #include <linux/mutex.h>
>>> #include <linux/list.h>
>>> #include <linux/fs.h>
>>> @@ -501,6 +502,53 @@ static int locate_mem_hole_callback(struct resource *res, void *arg)
>>> return locate_mem_hole_bottom_up(start, end, kbuf);
>>> }
>>>
>>> +#if defined(CONFIG_HAVE_MEMBLOCK) && !defined(CONFIG_ARCH_DISCARD_MEMBLOCK)
>>
>> The only caller is also guarded by these same ifdefs. Can't we remove this and
>> rely on the compilers dead-code elimination to remove this function when its not
>> needed?
>
> I don't think we can remove this #ifdef.
> "for_each_free_mem_range[_reverse]()" is defined under CONFIG_HAVE_MEMBLOCK
> in memblock.h. If some architecture wants to support KEXEC_FILE but
> doesn't have HAVE_MEMBLOCK, compiling kexec_file.c will fail.

Ah, I'd missed this, turns out memblock isn't ubiquitous!


Thanks,

James

\
 
 \ /
  Last update: 2018-07-09 13:04    [W:0.114 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site