Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp803276imm; Tue, 15 May 2018 09:23:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr9Yeuxq9hBkSPs28gqb2/iUA/aVbntfVJI/Zb4ZPL7vt8hM5hWuhnUNrXlgEILPwQWNjuT X-Received: by 2002:a62:4916:: with SMTP id w22-v6mr15792844pfa.63.1526401380731; Tue, 15 May 2018 09:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526401380; cv=none; d=google.com; s=arc-20160816; b=b3WEX1YZwfZvuXRpOMFNF0B+MbUNgWrM9iE4VT/gaVlznF3kAILZx+vko3ijsbYX3F fNqaiyWPMHmJs/p21ZJxgaxAtaSNLUIJCB2RmVXf5lAzTabtvuWRv5l1kbMt/RlrANxw 3fVroVQ+nufCOZ/YpWWonV8ETy2mV8mhdST8Iq7zXPMg5fHK1abyM07l28ZC/KtSvzRm +yyjC/rgirI9HncZCwa7lEgYfKiGM+rwxdSYPKnVXIBp+x49sK11YJ2eYeMbLGZHahzO EEg+HvJw7GQhZP/yPXUnv2Sb/RZXBrJPNX4RsfOVfGoxXb/Q5o+H4cXsUugm3LpTJxGi nkrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:cc:from:references:to:subject:arc-authentication-results; bh=DND15vA6V3K/LpRv7qm0ZKJhdvQuVZOOYRjDfWf2weE=; b=Rese0VPq8ocoCx85XZaO0+KPArbyYpGW4CDJCBHBOCIQbtpVlUsy+fOXpbBZ9+MnEe 648g2pWLJ3dAHCDVV+OfinDu3wIPp74tlam5AV6JAhWoKSlDQZsCNpk+StHtZQPV1gdi oNuv8P4ZpK76+H3LOubuUGKSXS1IZfWf9vyF/Dbe6FBg819e8/Moo174pXt1l1Bd4HH4 gPIdw23o9fRPfTmVU5sBE8CCAemcD0dgMTH/hWLzeQi4tZzQsQ6F28LNXjjM8j/FkmX6 IoVm9tdMw1FR7hJ94kkzjLHy6YntroKnm/K25mcMgbx48I0/UibtYABWC/vWGz+GqSy+ nVbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23-v6si300542pls.571.2018.05.15.09.22.44; Tue, 15 May 2018 09:23:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932089AbeEOQVE (ORCPT + 99 others); Tue, 15 May 2018 12:21:04 -0400 Received: from foss.arm.com ([217.140.101.70]:35156 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753700AbeEOQUu (ORCPT ); Tue, 15 May 2018 12:20:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 794F81529; Tue, 15 May 2018 09:20:49 -0700 (PDT) Received: from [10.1.207.55] (melchizedek.cambridge.arm.com [10.1.207.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 196E43F53D; Tue, 15 May 2018 09:20:43 -0700 (PDT) Subject: Re: [PATCH v9 04/11] arm64: kexec_file: allocate memory walking through memblock list To: AKASHI Takahiro References: <20180425062629.29404-1-takahiro.akashi@linaro.org> <20180425062629.29404-5-takahiro.akashi@linaro.org> <648656ef-1f1e-b0ac-581c-aba1e62f4eee@arm.com> <20180507055906.GE11326@linaro.org> <20180515043538.GB2737@linaro.org> From: James Morse Cc: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Message-ID: <84d5da84-81c4-d311-10e9-ba6afaf72a8e@arm.com> Date: Tue, 15 May 2018 17:17:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180515043538.GB2737@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Akashi, On 15/05/18 05:35, AKASHI Takahiro wrote: > On Mon, May 07, 2018 at 02:59:07PM +0900, AKASHI Takahiro wrote: >> On Tue, May 01, 2018 at 06:46:09PM +0100, James Morse wrote: >>> On 25/04/18 07:26, AKASHI Takahiro wrote: >>>> We need to prevent firmware-reserved memory regions, particularly EFI >>>> memory map as well as ACPI tables, from being corrupted by loading >>>> kernel/initrd (or other kexec buffers). We also want to support memory >>>> allocation in top-down manner in addition to default bottom-up. >>>> So let's have arm64 specific arch_kexec_walk_mem() which will search >>>> for available memory ranges in usable memblock list, >>>> i.e. !NOMAP & !reserved, >>> >>>> instead of system resource tree. >>> >>> Didn't we try to fix the system-resource-tree in order to fix regular-kexec to >>> be safe in the EFI-memory-map/ACPI-tables case? >>> >>> It would be good to avoid having two ways of doing this, and I would like to >>> avoid having extra arch code... >> >> I know what you mean. >> /proc/iomem or system resource is, in my opinion, not the best place to >> describe memory usage of kernel but rather to describe *physical* hardware >> layout. As we are still discussing about "reserved" memory, I don't want >> to depend on it. I agree. We have funny stuff that isn't hardware-layout, but is important for the next boot. The kernel doesn't have an ABI to support when it queries the list itself. >> Along with memblock list, we will have more accurate control over memory >> usage. >>> If the argument is walking memblock gives a better answer than the stringy >>> walk_system_ram_res() thing, is there any mileage in moving this code into >>> kexec_file.c, and using it if !IS_ENABLED(CONFIG_ARCH_DISCARD_MEMBLOCK)? >>> >>> This would save arm64/powerpc having near-identical implementations. >>> 32bit arm keeps memblock if it has kexec, so it may be useful there too if >>> kexec_file_load() support is added. > If you don't have further objection, I will take memblock approach > (with factoring out powerpc's arch_kexec_walk_mem()). If we're agreed that the memblock walking is generic, then it would be quicker to make the arm64 version as close as possible and merge them as a later series. (saves a cross arch dependency) With that, Reviewed-by: James Morse Thanks, James