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=-13.8 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 061D4C2BB9A for ; Tue, 15 Dec 2020 15:58:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 BC55122509 for ; Tue, 15 Dec 2020 15:58:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC55122509 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=FNogl1xPzVSOFWH4RzGH025MJzCfjp4QWIdmSMwMhBg=; b=nTZUeka4nlDXqiVwQ/kXSzofR q5M2dHjIe+gOEAdyyfzSBNwK76tB0ikVY3d3jujHyucwrgr25LAr7w9A0OVSQsMMIPAj5BFLHkMMp YFuye7AXwZ8RuqceU4jgvP0+0/Ip0fBUxTKOOcSJcPkq5Ifc5t1JGEvPRVjRin6GKAXv/xoNAfzOM C1WqyrF5PVFa51MiXc6boR5MsZ+LxICGCI5JSayJlsLPuIqNiB6LLQrvSthwP3sE9bjDZ8kBvhTNQ 5EMJhe/UBs5el8A8hxzsSmxO8tbDj3LuoECEms4qdULPe0pt4SE0hXa14Mrpv2a1hOVoNktAiQTaG CeR9y67Sg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpChm-0004qu-JG; Tue, 15 Dec 2020 15:57:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpChg-0004mP-DP for linux-arm-kernel@lists.infradead.org; Tue, 15 Dec 2020 15:57:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11C911FB; Tue, 15 Dec 2020 07:57:27 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.27.226]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 66BEA3F66E; Tue, 15 Dec 2020 07:57:25 -0800 (PST) Date: Tue, 15 Dec 2020 15:57:22 +0000 From: Mark Rutland To: Marc Zyngier Subject: Re: [PATCH] arm64: Warn the user when a small VA_BITS value wastes memory Message-ID: <20201215155722.GD21109@C02TD0UTHF1T.local> References: <20201215152918.1511108-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201215152918.1511108-1-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201215_105732_568575_5DEE737A X-CRM114-Status: GOOD ( 23.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, qperret@google.com 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 Tue, Dec 15, 2020 at 03:29:18PM +0000, Marc Zyngier wrote: > The memblock code ignores any memory that doesn't fit in the > linear mapping. In order to preserve the distance between two physical > memory locations and their mappings in the linear map, any hole between > two memory regions occupies the same space in the linear map. > > On most systems, this is hardly a problem (the memory banks are close > together, and VA_BITS represents a large space compared to the available > memory *and* the potential gaps). > > On NUMA systems, things are quite different: the gaps between the > memory nodes can be pretty large compared to the memory size itself, > and the range from memblock_start_of_DRAM() to memblock_end_of_DRAM() > can exceed the space described by VA_BITS. > > Unfortunately, we're not very good at making this obvious to the user, > and on a D05 system (two sockets and 4 nodes with 64GB each) > accidentally configured with 39bit VA, we display something like this: > > [ 0.000000] NUMA: NODE_DATA [mem 0x1ffbffe100-0x1ffbffffff] > [ 0.000000] NUMA: NODE_DATA [mem 0x2febfc1100-0x2febfc2fff] > [ 0.000000] NUMA: Initmem setup node 2 [] > [ 0.000000] NUMA: NODE_DATA [mem 0x2febfbf200-0x2febfc10ff] > [ 0.000000] NUMA: NODE_DATA(2) on node 1 > [ 0.000000] NUMA: Initmem setup node 3 [] > [ 0.000000] NUMA: NODE_DATA [mem 0x2febfbd300-0x2febfbf1ff] > [ 0.000000] NUMA: NODE_DATA(3) on node 1 > > which isn't very explicit, and doesn't tell the user why 128GB > have suddently disappeared. > > Let's add a warning message telling the user that memory has been > truncated, and offer a potential solution (bumping VA_BITS up). > > Signed-off-by: Marc Zyngier > --- > arch/arm64/mm/init.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index 095540667f0f..cd5da059de85 100644 > --- a/arch/arm64/mm/init.c > +++ b/arch/arm64/mm/init.c > @@ -283,6 +283,9 @@ void __init arm64_memblock_init(void) > memstart_addr = round_down(memblock_start_of_DRAM(), > ARM64_MEMSTART_ALIGN); > > + if ((memblock_end_of_DRAM() - memstart_addr) > linear_region_size) > + pr_warn("Memory doesn't fit in the linear mapping, VA_BITS too small\n"); Hmm... we might want to restructure this code a bit, since we have a few checks that are /almost/ the same, and we could probably place all the memory clipping under this new condition. That said, after having a go, I couldn't find a neat solution. FWIW, for this as-is: Acked-by: Mark Rutland Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel