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=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B5276C433E0 for ; Wed, 10 Mar 2021 13:25:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5008064FE8 for ; Wed, 10 Mar 2021 13:25:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5008064FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rUdjpHKgbnxMmC5YrahSXqjKDKXme+wa+LVh7eASSAg=; b=gNRRN9i2hmX5KcnYPapOGh5JR R595C5JSed0Ij5zjn4LN4aDMFcmNA3kqBt12cijFgSoIErvp8WnbbNYzbHByIEzColp8OuAHkmoHu kBVXdIr3XcvF17++hRp9Oy1BI3C02GgflBWSGmod8bVbEzD16vn6C4c221Yl0sTfE8sTXzg+tdI6P 10kju23ePalgrzwyjzudMyPXmyvsNms6Rua6uLK71SiNRJa4nzRK4B/U6V7k9UYxaz6coM86j7Va3 1ALh//HXQhLimL9C3CTW9tpCnPXS/imZCWxD9F3A4redAzO8QiSOA1ogqXDGzfa+TAMiVPsituSvw Ig/2JZjXw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJyoE-006tdx-Go; Wed, 10 Mar 2021 13:23:30 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJyo8-006tcx-7q for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 13:23:26 +0000 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12ADF6lW111963; Wed, 10 Mar 2021 08:23:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=KJ2P4qcc4rsGbj2BuyQmPVArgoyZQ5w39ZOjQJ5m6rM=; b=lWkQ/NfC5VrvYkcWLMwVLYRZPkNRdU5/AdY7fSA4eaJPFDax/Ynbcna5NuKTuNQrLi0J 55WOoikble0awwD+AnP7qdagBfcqlVCDiDiPWQZBCGiaXjkWd6KTJrlljoZiu5JaJOM+ VF88kUkIlHM8pkNeXseMxde7CUfdxxvXPuOX2VWfq5FoTFBzcvPTmpUCbSe0NNTVKsju tRW6i4am5+WCT03uJ4G0vVnBk8EZqg/AGbYw8j/3g5/gELPIEBQz472FP2OBmxP3aQqy k9xWYcwDgNenQ5lhYj4s1YkMRVx9VT6kBOKS3oWlEW1vuPGqScYBBo0yhk4eHmf5S3M4 eA== 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 376gwtd6jm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Mar 2021 08:23:17 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12ADN8YB032643; Wed, 10 Mar 2021 13:23:15 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 3768t4h0rn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Mar 2021 13:23:15 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12ADNDXU45154786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Mar 2021 13:23:13 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5ABB5A4040; Wed, 10 Mar 2021 13:23:13 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E17C2A4051; Wed, 10 Mar 2021 13:23:12 +0000 (GMT) Received: from linux.ibm.com (unknown [9.145.23.212]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 10 Mar 2021 13:23:12 +0000 (GMT) Date: Wed, 10 Mar 2021 15:23:10 +0200 From: Mike Rapoport To: Vladimir Murzin Cc: linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org Subject: Re: [PATCH] ARM: NOMMU: Fix conversion for_each_membock() to for_each_mem_range() Message-ID: References: <20210310102013.91253-1-vladimir.murzin@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210310102013.91253-1-vladimir.murzin@arm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-10_08:2021-03-10, 2021-03-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 mlxscore=0 mlxlogscore=806 clxscore=1011 bulkscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103100063 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_132324_603334_6E42D667 X-CRM114-Status: GOOD ( 28.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 10, 2021 at 10:20:13AM +0000, Vladimir Murzin wrote: > for_each_mem_range() uses a loop variable, yet looking into code it is > not just iteration counter but more complex entity which encodes > information about memblock. Thus condition i == 0 looks fragile. > Indeed, it broke boot of R-class platforms since it never took i == 0 > path (due to i was set to 1). Oops, sorry about that. > Fix that with restoring original flag > check. > > Fixes: b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()") > Signed-off-by: Vladimir Murzin Acked-by: Mike Rapoport > --- > arch/arm/mm/pmsa-v7.c | 4 +++- > arch/arm/mm/pmsa-v8.c | 4 +++- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mm/pmsa-v7.c b/arch/arm/mm/pmsa-v7.c > index 88950e41a3a9..59d916ccdf25 100644 > --- a/arch/arm/mm/pmsa-v7.c > +++ b/arch/arm/mm/pmsa-v7.c > @@ -235,6 +235,7 @@ void __init pmsav7_adjust_lowmem_bounds(void) > phys_addr_t mem_end; > phys_addr_t reg_start, reg_end; > unsigned int mem_max_regions; > + bool first = true; > int num; > u64 i; > > @@ -263,7 +264,7 @@ void __init pmsav7_adjust_lowmem_bounds(void) > #endif > > for_each_mem_range(i, ®_start, ®_end) { > - if (i == 0) { > + if (first) { > phys_addr_t phys_offset = PHYS_OFFSET; > > /* > @@ -275,6 +276,7 @@ void __init pmsav7_adjust_lowmem_bounds(void) > mem_start = reg_start; > mem_end = reg_end; > specified_mem_size = mem_end - mem_start; > + first = false; > } else { > /* > * memblock auto merges contiguous blocks, remove > diff --git a/arch/arm/mm/pmsa-v8.c b/arch/arm/mm/pmsa-v8.c > index 2de019f7503e..8359748a19a1 100644 > --- a/arch/arm/mm/pmsa-v8.c > +++ b/arch/arm/mm/pmsa-v8.c > @@ -95,10 +95,11 @@ void __init pmsav8_adjust_lowmem_bounds(void) > { > phys_addr_t mem_end; > phys_addr_t reg_start, reg_end; > + bool first = true; > u64 i; > > for_each_mem_range(i, ®_start, ®_end) { > - if (i == 0) { > + if (first) { > phys_addr_t phys_offset = PHYS_OFFSET; > > /* > @@ -107,6 +108,7 @@ void __init pmsav8_adjust_lowmem_bounds(void) > if (reg_start != phys_offset) > panic("First memory bank must be contiguous from PHYS_OFFSET"); > mem_end = reg_end; > + first = false; > } else { > /* > * memblock auto merges contiguous blocks, remove > -- > 2.24.0 > -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel