Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp698169pxa; Sat, 1 Aug 2020 03:20:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdAIcO/bOqLo4jAwvU9jtQBwo11OKIyvDVrPhSmGkkZO7l5dXeJ7xn2Kzq8H0p8+YHVwn1 X-Received: by 2002:a17:906:68b:: with SMTP id u11mr8476307ejb.143.1596277217296; Sat, 01 Aug 2020 03:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596277217; cv=none; d=google.com; s=arc-20160816; b=BOaU/EUYB8BqMii0dk74whSyDyVvDOrPrM8a/ucDTZXvPZuWsG6b7vjysIR5X/UBeZ rpYN7V6I2GNUJYjIB4iDSwubbUjDdXZ3YZLO8RaFSGNNJ7Mb+YKkxR7xeK1PDaymPZbl hYdKUWBVflr0VVKD2wK2XLKXKwviDT2f2uoTzNze/0i3iPIjzxezNbV7jdVuOLeA4RbQ dURUJCdbEBiqUdcXomtxaCz7eQ0RTbbIJXVjY8bj7pxEy8r+PvBl1nV6Xji5nZ814Chf NT7cf43czcfrhqt4R9pzkaKdi4uzukTt1jZivpR7giU83HTNFAF5ZKy9w/G86cHbqMj6 W3Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=WNJTO2Hhjh65ejJ0Q7rJcAG5+lKWJCjU0Dzff04y7qI=; b=zFiMO6yVj/XVaIYgyGsUKQx9gylxkVh6BVKpTKaYUPZis/65vtV5yNBbDTXR+PGOGF eLPxr0wJqSwngQ6mt59Nlk3sIjKv7E13cx2vPAG+1VwDMXcA19NK4P7J81DN2qXuP893 gsjyBNXM/k1spdKcMyqFNErKrf1R+wP8jJs8bwlHIMaZnXInDiJnJqSBsjWDFTFrC5pA +N5hvUpatyQGQua4M1j38lDYE8/iPVlng+dQoLanreRZLWe3DyOYoHmWtEwZ2c2RNPpX zRFZPJAKvOBZqTihIZfIxQbepewPijNnis15fHr3G3XK3aZL2SYk7P63F+9slOnxDVE3 ZiMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BOX5CM31; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s26si6986304ejv.28.2020.08.01.03.19.27; Sat, 01 Aug 2020 03:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BOX5CM31; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728846AbgHAKTM (ORCPT + 99 others); Sat, 1 Aug 2020 06:19:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:43666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726888AbgHAKTL (ORCPT ); Sat, 1 Aug 2020 06:19:11 -0400 Received: from kernel.org (unknown [87.70.91.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5ED692087C; Sat, 1 Aug 2020 10:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596277150; bh=jQD0i2dEJRPR8dDJK6vZOAFdpUe2Ho5YLvcSFtENhXg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BOX5CM31age4ZqR8WpA9Tu6Sib3TWB8q0axiVZJ9476Af21jQMyZgnRXNsbolGSGn pWpwQlO3I1Ym/ZhVqWnuEZ70zJ8p8UgBgfsl0uitfuYMEFBB9GFeRHX0dU8VC7876G 1GC7zC28lCBEAGXT18VZfRnXSGNcrY6WFAZx7Yv0= Date: Sat, 1 Aug 2020 13:18:54 +0300 From: Mike Rapoport To: Michael Ellerman Cc: Andrew Morton , Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Dave Hansen , Ingo Molnar , Marek Szyprowski , Max Filippov , Michal Simek , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Peter Zijlstra , Russell King , Stafford Horne , Thomas Gleixner , Will Deacon , Yoshinori Sato , clang-built-linux@googlegroups.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org, Hari Bathini Subject: Re: [PATCH 06/15] powerpc: fadamp: simplify fadump_reserve_crash_area() Message-ID: <20200801101854.GD534153@kernel.org> References: <20200728051153.1590-1-rppt@kernel.org> <20200728051153.1590-7-rppt@kernel.org> <87d04d5hda.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d04d5hda.fsf@mpe.ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 30, 2020 at 10:15:13PM +1000, Michael Ellerman wrote: > Mike Rapoport writes: > > From: Mike Rapoport > > > > fadump_reserve_crash_area() reserves memory from a specified base address > > till the end of the RAM. > > > > Replace iteration through the memblock.memory with a single call to > > memblock_reserve() with appropriate that will take care of proper memory > ^ > parameters? > > reservation. > > > > Signed-off-by: Mike Rapoport > > --- > > arch/powerpc/kernel/fadump.c | 20 +------------------- > > 1 file changed, 1 insertion(+), 19 deletions(-) > > I think this looks OK to me, but I don't have a setup to test it easily. > I've added Hari to Cc who might be able to. > > But I'll give you an ack in the hope that it works :) Actually, I did some digging in the git log and the traversal was added there on purpose by the commit b71a693d3db3 ("powerpc/fadump: exclude memory holes while reserving memory in second kernel") Presuming this is still reqruired I'm going to drop this patch and will simply replace for_each_memblock() with for_each_mem_range() in v2. > Acked-by: Michael Ellerman > > > > diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c > > index 78ab9a6ee6ac..2446a61e3c25 100644 > > --- a/arch/powerpc/kernel/fadump.c > > +++ b/arch/powerpc/kernel/fadump.c > > @@ -1658,25 +1658,7 @@ int __init fadump_reserve_mem(void) > > /* Preserve everything above the base address */ > > static void __init fadump_reserve_crash_area(u64 base) > > { > > - struct memblock_region *reg; > > - u64 mstart, msize; > > - > > - for_each_memblock(memory, reg) { > > - mstart = reg->base; > > - msize = reg->size; > > - > > - if ((mstart + msize) < base) > > - continue; > > - > > - if (mstart < base) { > > - msize -= (base - mstart); > > - mstart = base; > > - } > > - > > - pr_info("Reserving %lluMB of memory at %#016llx for preserving crash data", > > - (msize >> 20), mstart); > > - memblock_reserve(mstart, msize); > > - } > > + memblock_reserve(base, memblock_end_of_DRAM() - base); > > } > > > > unsigned long __init arch_reserved_kernel_pages(void) > > -- > > 2.26.2 -- Sincerely yours, Mike.