From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F2F5C6778C for ; Tue, 3 Jul 2018 16:36:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 342EC2064D for ; Tue, 3 Jul 2018 16:36:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 342EC2064D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933976AbeGCQgc (ORCPT ); Tue, 3 Jul 2018 12:36:32 -0400 Received: from foss.arm.com ([217.140.101.70]:52528 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932392AbeGCQga (ORCPT ); Tue, 3 Jul 2018 12:36:30 -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 A7C8C7A9; Tue, 3 Jul 2018 09:36:30 -0700 (PDT) Received: from [10.1.206.34] (melchizedek.cambridge.arm.com [10.1.206.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B5DF3F5BA; Tue, 3 Jul 2018 09:36:26 -0700 (PDT) Subject: Re: [PATCH v10 03/14] powerpc, kexec_file: factor out memblock-based arch_kexec_walk_mem() To: AKASHI Takahiro 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, "Eric W. Biederman" References: <20180623022058.10935-1-takahiro.akashi@linaro.org> <20180623022058.10935-4-takahiro.akashi@linaro.org> From: James Morse Message-ID: <8a59db79-6379-550b-b20e-01036626904e@arm.com> Date: Tue, 3 Jul 2018 17:36:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180623022058.10935-4-takahiro.akashi@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 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 Does this file still need its memblock.h include? > 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 > #include > #include > +#include > #include > #include > #include > @@ -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? > +static int kexec_walk_memblock(struct kexec_buf *kbuf, > + int (*func)(struct resource *, void *)) > +{ > + u64 i; > + phys_addr_t mstart, mend; > + struct resource res = { }; > + int ret = 0; Keeping this patch as 'just' moving code would avoid having to play spot-the-difference: > + if (kbuf->image->type == KEXEC_TYPE_CRASH) > + return func(&crashk_res, kbuf); This will be new for powerpc, but any attempt to use it should be caught by arch_kexec_kernel_image_probe(), which has: | /* We don't support crash kernels yet. */ | if (image->type == KEXEC_TYPE_CRASH) | return -EOPNOTSUPP; Looks good to me! For what its worth: Acked-by: James Morse Thanks, James