Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423218AbdD0WAi (ORCPT ); Thu, 27 Apr 2017 18:00:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52337 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1033143AbdD0WAc (ORCPT ); Thu, 27 Apr 2017 18:00:32 -0400 From: Thiago Jung Bauermann To: AKASHI Takahiro Cc: dyoung@redhat.com, bhe@redhat.com, vgoyal@redhat.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kexec: allocate buffer in top-down, if specified, correctly Date: Thu, 27 Apr 2017 19:00:04 -0300 User-Agent: KMail/5.2.3 (Linux/4.4.0-72-generic; KDE/5.28.0; x86_64; ; ) In-Reply-To: <20170426082209.12127-1-takahiro.akashi@linaro.org> References: <20170426082209.12127-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-TM-AS-MML: disable x-cbid: 17042722-0032-0000-0000-000005595DAE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042722-0033-0000-0000-000011DE5E57 Message-Id: <1605356.Vp6YPvtjly@morokweng> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-27_18:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704270348 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 944 Lines: 26 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. Isn't it possible to walk resources from top to bottom? > 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. -- Thiago Jung Bauermann IBM Linux Technology Center