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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C248C433EF for ; Tue, 28 Sep 2021 16:37:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BBD5B60F5B for ; Tue, 28 Sep 2021 16:37:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BBD5B60F5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4344E6B006C; Tue, 28 Sep 2021 12:37:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E49B6B0071; Tue, 28 Sep 2021 12:37:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2AC626B0072; Tue, 28 Sep 2021 12:37:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 1D0F26B006C for ; Tue, 28 Sep 2021 12:37:58 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CE81F181CC1C4 for ; Tue, 28 Sep 2021 16:37:57 +0000 (UTC) X-FDA: 78637538994.25.53DECA9 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP id 7B9005067566 for ; Tue, 28 Sep 2021 16:37:57 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E6D96124B; Tue, 28 Sep 2021 16:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632847076; bh=SMngk4vQyYJh6Ix2Aws/opaA6OUWDxu+nMCYjp9HT1g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iQgVWDbxrCaIXjszezjeShLIeggiuTGcNQ1kUNhlzz7L0iQPQpzMj3GWe9wAa83nE xixsfm9d1hqwYDvSP6/GmrOO92hD7ltNJOXIhNKmkS+/il7busZ7WxoK/kqcpVsvDR e/kiO2wqfW7dkNV80GGgOUqZ5DdiBiAf9pcqjVks+d5QN1jqaRRa6IavDliHyL7UIn fKt0uLNwvrHFm31u8lclGjdcS8e8j/k6BHO9q19aFkxbvVwNswsqrL3WblpzcpP/Up /EXgGepiez2LFYK8xweyCGaxty38Acn3ySjTGv5fn/yqwWgK5w70RXxn0FYFF0uJo2 21cKFAw9fxEsQ== Date: Tue, 28 Sep 2021 09:37:55 -0700 From: Mike Rapoport To: "Peng Fan (OSS)" Cc: akpm@linux-foundation.org, david@redhat.com, geert+renesas@glider.be, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Peng Fan Subject: Re: [PATCH] memblock: check memory total_size Message-ID: References: <20210928105057.3406-1-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210928105057.3406-1-peng.fan@oss.nxp.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 7B9005067566 X-Stat-Signature: 9bt7jrkw8bkpdyo5o3preud6u7c3grpq Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iQgVWDbx; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=rppt@kernel.org X-HE-Tag: 1632847077-691308 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, On Tue, Sep 28, 2021 at 06:50:57PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > mem=[X][G|M] is broken on NXP i.MX ARM64 platform, there is cases that > even type.cnt is 1, but total_size is not 0 because regions are merged > into 1. So only check 'cnt' is not enough, total_size also needs to be > taked into consideration, othersize bootargs 'mem=[X][G|B]' not work > anymore. I believe this is issue is not specific to i.MX but rather this could happen on any arm64 platform. Can you please update the changelog? > Fixes: e888fa7bb882 ("memblock: Check memory add/cap ordering") > Cc: Mike Rapoport > Cc: Geert Uytterhoeven > Cc: David Hildenbrand > Signed-off-by: Peng Fan > --- > mm/memblock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memblock.c b/mm/memblock.c > index 184dcd2e5d99..ab67b82a9cce 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1687,7 +1687,7 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size) > if (!size) > return; > > - if (memblock.memory.cnt <= 1) { > + if (memblock_memory->cnt <= 1 && !memblock_memory->total_size) { The test for non-zero total size shold be sufficient here. > pr_warn("%s: No memory registered yet\n", __func__); > return; > } > -- > 2.30.0 > -- Sincerely yours, Mike.