Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp714460pxa; Sat, 1 Aug 2020 03:55:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi99/aENYwNtmoxwdp9h9Hn5j0YTiEItKouZF1eBOEhweHyaFMBNSfcZzC3R48F16vKFcQ X-Received: by 2002:a17:907:7204:: with SMTP id dr4mr7959497ejc.258.1596279351393; Sat, 01 Aug 2020 03:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596279351; cv=none; d=google.com; s=arc-20160816; b=nIDQQJVI1vWWUkWUEXKmjKSU7P58xe3OekM/L/5kb36mt03oyzJV2mQywtCLMjmG5j JI4YgxHva1LAXA+Q7YcHjcfv7nNTE3RA0CArZf3aydgLTTp9AdySZFU7XI0rphwbnv26 H6wmNK9KFUE8gPzhm4y7bzQemonmfANHNrneRdFCLgCRmUa4dLcRMffHjATBWioeHM8J vM2H/bIZ2EI/VYv9RqBIKV5l3X5ZujyevSu9/tQYo8PnXDO/ckJfKF4cqhAXRw5Hick3 iPHklBKTs2tiJYF49IzYV4BAid5g8dCVwgeuLTTONVfkCMLJZayw6/chcI4Z4GWOYKsF IT9w== 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:from:references:cc:to:subject; bh=6LTV0ahRKfWPA3HObbzPIH/aqso7A7OC+N0nWY8aoIQ=; b=DWPlqGBhzHsoOvKf5+9z7dAFXw6AVM2JfQeIFsf3gHmAhvjnfHaaWnyYUTMnkEJtWL TugS+HHOJ3T/Kgkv65O7QUJmMoePCrFTTUHk5IrTNpEmQU5RcYV4xKkcOLT945Wh0F14 kSdKtKVd3W+rgIIwr57g7lQzw/a4LTJ/FKHKI+/x1Rf5EQ119NtF0rfdMKArI5+7QUV4 kWrtWofH1h8yHNyHM+ccgnA888e3D1/I0zfHyCs08UiVBhJ0U2FHr0hgMhKmpanU6iHH YKqRL1f1vz16TiD1XF/Sspa4qSSiU3mv70Twv4LQ5LWeokPvQX/MjPddl08E5FNoQk+u M4Ig== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si7773615edc.318.2020.08.01.03.55.11; Sat, 01 Aug 2020 03:55:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbgHAKy5 (ORCPT + 99 others); Sat, 1 Aug 2020 06:54:57 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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