Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2708045imm; Sun, 30 Sep 2018 03:10:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV60iAFEyg95yzh6YHk1UP/TtdDDlYRajEQGCkOEKqSuFZc7zCZtSxfGxhJ3ulO+6K/di75uc X-Received: by 2002:a63:8442:: with SMTP id k63-v6mr5919663pgd.388.1538302236929; Sun, 30 Sep 2018 03:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538302236; cv=none; d=google.com; s=arc-20160816; b=P17VAQoQL5j72SfhhqNI45a7gigv5RfwJpB0/Zpi7Hxwlhq+Qsi3ENf8Nnqo9rjHYX 6bGyyfUDF/i2uU3CesHBf8zdfCbUbBSmRtPimFFuMsOrz0hzVJwnZIbVzyidz7pU8MvO kr/kwiMjRcIqCkiBgTOfB1HDOT0HONHGUdmAUf0VMFVKpMALZoKUcin2SyWrAYdaT0AF tdKoBUjEzX1264IwnRi96r7qwVMpDcppX8eW+6Qpxo7HamUiVbqpMV1GozWNK+zvpVrm RNCe7xItE49ZlFXztPOReyDZ4Fuy7cNMZDm2ZpAmNhu9KN+E6TZzF1aSGzKMDQdRWrkm VZBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=nx0AyJQ2Wh3dbRomXC0Bii4HobBdp8GfrKbT5GyXJVM=; b=lvk/DKNIUGATkMP6P60Kh6nsx416UeOdEfylasRvYW5GQsBka8JyumTaNfd9rBElch ZtHmn0D9lWiJZpx4b8WhE7Nti3B6NGFQF2WvTdVOIiRxUr01nL4dDwtsHPEGjC3ilu8y UClzDYK5bj7veZ6ltdALGKdVw3IY82l3ilYFDAHfvbu5hUvV6XS5WWuL9n+Q/sOs8zn7 iL5JCcAfRS7ZY1Zh+SNevVQQne2oXVTSOyVNpqz0xjooDZ+QYLvj7lzj5oVSWGD4OPSA SPknzPdBTtgMwf5r8Qo6Q8AIfy38pL6lFdQGhboY4nz3NgS5800Z4wFcetNqfzmty5h/ vWRQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go1si2380487plb.242.2018.09.30.03.10.21; Sun, 30 Sep 2018 03:10:36 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728185AbeI3QlM (ORCPT + 99 others); Sun, 30 Sep 2018 12:41:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50594 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbeI3QlL (ORCPT ); Sun, 30 Sep 2018 12:41:11 -0400 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F134881F0E; Sun, 30 Sep 2018 10:08:48 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-158.pek2.redhat.com [10.72.12.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF7633091326; Sun, 30 Sep 2018 10:08:38 +0000 (UTC) Date: Sun, 30 Sep 2018 18:08:34 +0800 From: Dave Young 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, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, prudo@linux.ibm.com, james.morse@arm.com, "Eric W. Biederman" , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v15 04/16] powerpc, kexec_file: factor out memblock-based arch_kexec_walk_mem() Message-ID: <20180930100834.GD6950@dhcp-128-65.nay.redhat.com> References: <20180928064841.14117-1-takahiro.akashi@linaro.org> <20180928064841.14117-5-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180928064841.14117-5-takahiro.akashi@linaro.org> User-Agent: Mutt/1.9.5 (2018-04-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 30 Sep 2018 10:08:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi AKASHI, On 09/28/18 at 03:48pm, AKASHI Takahiro wrote: > Memblock list is another source for usable system memory layout. > So move powerpc's arch_kexec_walk_mem() to common code so that other > memblock-based architectures, particularly arm64, can also utilise it. > A moved function is now renamed to kexec_walk_memblock() and integrated > into kexec_locate_mem_hole(), which will now be usable for all > architectures with no need for overriding arch_kexec_walk_mem(). > > With this change, arch_kexec_walk_mem() need no longer be a weak function, > and was now renamed to kexec_walk_resources(). > > Since powerpc doesn't support kdump in its kexec_file_load(), the current > kexec_walk_memblock() won't work for kdump either in this form, this will > be fixed in the next patch. > > Signed-off-by: AKASHI Takahiro > Cc: "Eric W. Biederman" > Acked-by: Dave Young > Cc: Vivek Goyal > Cc: Baoquan He > Acked-by: James Morse [snip] > + > /** > * arch_kexec_walk_mem - call func(data) on free memory regions The function name should be updated as well. > * @kbuf: Context info for the search. Also passed to @func. > @@ -510,8 +560,8 @@ static int locate_mem_hole_callback(struct resource *res, void *arg) > * and that value will be returned. If all free regions are visited without > * func returning non-zero, then zero will be returned. > */ > -int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf, > - int (*func)(struct resource *, void *)) > +static int kexec_walk_resources(struct kexec_buf *kbuf, > + int (*func)(struct resource *, void *)) > { > if (kbuf->image->type == KEXEC_TYPE_CRASH) > return walk_iomem_res_desc(crashk_res.desc, > @@ -538,7 +588,11 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf) > if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN) > return 0; > > - ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback); > + if (IS_ENABLED(CONFIG_HAVE_MEMBLOCK) && > + !IS_ENABLED(CONFIG_ARCH_DISCARD_MEMBLOCK)) > + ret = kexec_walk_memblock(kbuf, locate_mem_hole_callback); > + else > + ret = kexec_walk_resources(kbuf, locate_mem_hole_callback); > > return ret == 1 ? 0 : -EADDRNOTAVAIL; > } > -- > 2.19.0 > Thanks Dave