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=-12.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 6AFB3C433DF for ; Sat, 1 Aug 2020 10:54:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5514E2087C for ; Sat, 1 Aug 2020 10:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728505AbgHAKy4 (ORCPT ); Sat, 1 Aug 2020 06:54:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45114 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725931AbgHAKy4 (ORCPT ); Sat, 1 Aug 2020 06:54:56 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 071AWipj009926; Sat, 1 Aug 2020 06:53:31 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32n4j1tj4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 01 Aug 2020 06:53:31 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 071AineF032275; Sat, 1 Aug 2020 06:53:30 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 32n4j1tj43-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 01 Aug 2020 06:53:30 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 071AoAw0031317; Sat, 1 Aug 2020 10:53:27 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 32n01809gg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 01 Aug 2020 10:53:27 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 071ArONv53215310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 1 Aug 2020 10:53:24 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E75411C04A; Sat, 1 Aug 2020 10:53:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5269A11C04C; Sat, 1 Aug 2020 10:53:16 +0000 (GMT) Received: from [9.102.1.22] (unknown [9.102.1.22]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 1 Aug 2020 10:53:16 +0000 (GMT) Subject: Re: [PATCH 06/15] powerpc: fadamp: simplify fadump_reserve_crash_area() To: Mike Rapoport , Michael Ellerman Cc: linux-sh@vger.kernel.org, Peter Zijlstra , Dave Hansen , Hari Bathini , linux-mips@vger.kernel.org, Max Filippov , Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Stafford Horne , Marek Szyprowski , linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , x86@kernel.org, Russell King , Mike Rapoport , clang-built-linux@googlegroups.com, Ingo Molnar , Catalin Marinas , uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, Borislav Petkov , Andy Lutomirski , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Michal Simek , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Palmer Dabbelt , Andrew Morton , Christoph Hellwig References: <20200728051153.1590-1-rppt@kernel.org> <20200728051153.1590-7-rppt@kernel.org> <87d04d5hda.fsf@mpe.ellerman.id.au> <20200801101854.GD534153@kernel.org> From: Hari Bathini Message-ID: Date: Sat, 1 Aug 2020 16:23:15 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200801101854.GD534153@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-01_07:2020-07-31,2020-08-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 phishscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008010079 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On 01/08/20 3:48 pm, Mike Rapoport wrote: > 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") I was about to comment on the same :) memblock_reserve() was being used until we ran into the issue talked about in the above commit... > Presuming this is still reqruired I'm going to drop this patch and will Yeah, it is still required.. > simply replace for_each_memblock() with for_each_mem_range() in v2. Sounds right. > >> 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 > Thanks Hari