[PATCH] kexec: allocate buffer in top-down, if specified, correctly

AKASHI Takahiro takahiro.akashi at linaro.org
Thu Apr 27 17:51:39 PDT 2017


Thank you for the comment.

On Thu, Apr 27, 2017 at 07:00:04PM -0300, Thiago Jung Bauermann wrote:
> Hello,
> Am Mittwoch, 26. April 2017, 17:22:09 BRT schrieb AKASHI Takahiro:
> > The current kexec_locate_mem_hole(kbuf.top_down == 1) stops searching at
> > the first memory region that has enough space for requested size even if
> > some of higher regions may also have.
> kexec_locate_mem_hole expects arch_kexec_walk_mem to walk memory from top to 
> bottom if top_down is true. That is what powerpc's version does.

Ah, I haven't noticed that, but x86 doesn't have arch_kexec_walk_mem and
how can it work for x86?

> Isn't it possible to walk resources from top to bottom?

Yes, it will be, but it seems to me that such a behavior is not intuitive
and even confusing if it doesn't come with explicit explanation.

> > This behavior is not consistent with locate_hole(hole_end == -1) function
> > of kexec-tools.
> > 
> > This patch fixes the bug, going though all the memory regions anyway.
> This patch would break powerpc, because at the end of the memory walk kbuf 
> would have the lowest memory hole.
> If it's not possible to walk resources in reverse order, then this patch needs 
> to change powerpc to always walk memory from bottom to top.

So I would like to hear from x86 guys.

-Takahiro AKASHI

> -- 
> Thiago Jung Bauermann
> IBM Linux Technology Center

More information about the kexec mailing list