[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180716122412.GA7160@dhcp-128-65.nay.redhat.com>
Date: Mon, 16 Jul 2018 20:24:12 +0800
From: Dave Young <dyoung@...hat.com>
To: James Morse <james.morse@....com>
Cc: AKASHI Takahiro <takahiro.akashi@...aro.org>,
catalin.marinas@....com, will.deacon@....com, dhowells@...hat.com,
vgoyal@...hat.com, herbert@...dor.apana.org.au,
davem@...emloft.net, bhe@...hat.com, arnd@...db.de,
ard.biesheuvel@...aro.org, bhsharma@...hat.com,
kexec@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH v11 03/15] powerpc, kexec_file: factor out memblock-based
arch_kexec_walk_mem()
On 07/16/18 at 12:04pm, James Morse wrote:
> Hi Dave,
>
> On 14/07/18 02:52, Dave Young wrote:
> > On 07/11/18 at 04:41pm, AKASHI Takahiro wrote:
> >> Memblock list is another source for usable system memory layout.
> >> So powerpc's arch_kexec_walk_mem() is moved to kexec_file.c so that
> >> other memblock-based architectures, particularly arm64, can also utilise
> >> it. A moved function is now renamed to kexec_walk_memblock() and merged
> >> into the existing arch_kexec_walk_mem() for general use, either resource
> >> list or memblock list.
> >>
> >> A consequent function will not work for kdump with memblock list, but
> >> this will be fixed in the next patch.
>
> >> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>
> >> @@ -513,6 +563,10 @@ static int locate_mem_hole_callback(struct resource *res, void *arg)
> >> int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
> >> int (*func)(struct resource *, void *))
> >> {
> >> + if (IS_ENABLED(CONFIG_HAVE_MEMBLOCK) &&
> >> + !IS_ENABLED(CONFIG_ARCH_DISCARD_MEMBLOCK))
> >> + return kexec_walk_memblock(kbuf, func);
> >
> > AKASHI, I'm not sure if this works on all arches, for example I chekced
> > the .config on my Nokia N900 kernel tree, there is HAVE_MEMBLOCK=y and
> > no CONFIG_ARCH_DISCARD_MEMBLOCK, in 32bit arm code no arch_kexec_walk_mem()
> By doesn't work you mean it's a change in behaviour?
> I think this is fine because 32bit arm doesn't support KEXEC_FILE, (this file is
> kexec_file specific right?).
Ah, replied on a train, I forgot this is only for kexec_file, sorry
about that. Please ignore the comment.
But since we have a weak function arch_kexec_walk_mem, adding another
condition branch within this weak function looks not good.
Something like below would be better:
int kexec_locate_mem_hole(struct kexec_buf *kbuf)
{
int ret;
+ if use memblock
+ ret = kexec_walk_memblock()
+ else
ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
return ret == 1 ? 0 : -EADDRNOTAVAIL;
}
>
> It only affects architectures with MEMBLOCK and KEXEC_FILE: powerpc, s390 and
> soon arm64. s390 keeps its behaviour because it provides arch_kexec_walk_mem(),
> and powerpc's is copied in here as its generic 'memblock describes my memory'
> stuff. The implementation would be the same on arm64, so we're doing this to
> avoid duplicating otherwise generic arch code. I think 32bit arm should be able
> to use this too if it gets KEXEC_FILE support. (32bit arms' KEXEC already
> depends on MEMBLOCK).
>
>
> Thanks,
>
> James
Thanks
Dave
Powered by blists - more mailing lists