From patchwork Mon Oct 18 22:15:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12568189 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 A0A5DC433EF for ; Mon, 18 Oct 2021 22:15:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6CBE2610FB for ; Mon, 18 Oct 2021 22:15:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6CBE2610FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 13EE094000C; Mon, 18 Oct 2021 18:15:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C8AF940007; Mon, 18 Oct 2021 18:15:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED26E94000C; Mon, 18 Oct 2021 18:15:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id D6B29940007 for ; Mon, 18 Oct 2021 18:15:47 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A3E6E3A7BC for ; Mon, 18 Oct 2021 22:15:47 +0000 (UTC) X-FDA: 78710966334.12.763007B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP id 2B1C51000098 for ; Mon, 18 Oct 2021 22:15:50 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FACE6113D; Mon, 18 Oct 2021 22:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1634595346; bh=l3XYSctveQCuBNkQuKRXWwx2EV1pKzu5RQE/jIJqSrQ=; h=Date:From:To:Subject:In-Reply-To:From; b=XdBVC3eUF8KVhBqyH5pjVYdtjZ++h4a+nSzEUy5QTFmVxWYVgEsqJ2NNnLk502pLf Vf+e/afEKfgLpsCggYzWsx+OpabSJW0jglEmTJO24H+Y0qmMnTGuDKet6DQexjHmE0 KZaZMX5jShBzKNk48CUEathixz+7l0/E445hIw5c= Date: Mon, 18 Oct 2021 15:15:45 -0700 From: Andrew Morton To: akpm@linux-foundation.org, david@redhat.com, geert+renesas@glider.be, linux-mm@kvack.org, mm-commits@vger.kernel.org, peng.fan@nxp.com, rppt@linux.ibm.com, torvalds@linux-foundation.org Subject: [patch 08/19] memblock: check memory total_size Message-ID: <20211018221545.8GMak4XZn%akpm@linux-foundation.org> In-Reply-To: <20211018151438.f2246e2656c041b6753a8bdd@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: 2B1C51000098 X-Stat-Signature: m83z58on5wkdktt5t47xhwn4d16f799y Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=XdBVC3eU; dmarc=none; spf=pass (imf07.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam02 X-HE-Tag: 1634595350-997085 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: From: Peng Fan Subject: memblock: check memory total_size mem=[X][G|M] is broken on ARM64 platform, there are 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 should be used, othersize bootargs 'mem=[X][G|B]' not work anymore. Link: https://lkml.kernel.org/r/20210930024437.32598-1-peng.fan@oss.nxp.com Fixes: e888fa7bb882 ("memblock: Check memory add/cap ordering") Signed-off-by: Peng Fan Reviewed-by: Mike Rapoport Cc: Geert Uytterhoeven Cc: David Hildenbrand Signed-off-by: Andrew Morton --- mm/memblock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memblock.c~memblock-check-memory-total_size +++ a/mm/memblock.c @@ -1692,7 +1692,7 @@ void __init memblock_cap_memory_range(ph if (!size) return; - if (memblock.memory.cnt <= 1) { + if (!memblock_memory->total_size) { pr_warn("%s: No memory registered yet\n", __func__); return; }