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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 0D154C11F64 for ; Thu, 1 Jul 2021 19:01:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1ACC613D3 for ; Thu, 1 Jul 2021 19:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234026AbhGATDs (ORCPT ); Thu, 1 Jul 2021 15:03:48 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:45867 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233998AbhGATDo (ORCPT ); Thu, 1 Jul 2021 15:03:44 -0400 Received: (Authenticated sender: alex@ghiti.fr) by relay12.mail.gandi.net (Postfix) with ESMTPSA id B2072200005; Thu, 1 Jul 2021 19:01:10 +0000 (UTC) Subject: Re: [PATCH 1/3] riscv: Fix memory_limit for 64-bit kernel To: Kefeng Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210629091349.3802690-1-alex@ghiti.fr> <6a38fb9a-d658-836b-4ff4-7c47cadb7db0@huawei.com> From: Alex Ghiti Message-ID: <8e1bef59-8a65-dfdf-d09d-f578323348be@ghiti.fr> Date: Thu, 1 Jul 2021 21:01:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <6a38fb9a-d658-836b-4ff4-7c47cadb7db0@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 1/07/2021 à 12:44, Kefeng Wang a écrit : > > On 2021/6/29 17:13, Alexandre Ghiti wrote: >> As described in Documentation/riscv/vm-layout.rst, the end of the >> virtual address space for 64-bit kernel is occupied by the modules/BPF/ >> kernel mappings so this actually reduces the amount of memory we are able >> to map and then use in the linear mapping. So make sure this limit is >> correctly set. >> >> Fixes: c9811e379b21 ("riscv: Add mem kernel parameter support") > > > Should the Fixes tag be de043da0b9e7 (“RISC-V: Fix usage of > memblock_enforce_memory_limit“), > > The -PAGE_OFFSET is set to the maximal physical memory from this point :) Oops, thank you! Alex > >> Signed-off-by: Alexandre Ghiti >> --- >>   arch/riscv/mm/init.c | 11 +++++++++-- >>   1 file changed, 9 insertions(+), 2 deletions(-) >> >> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >> index 12f956b3a674..04a5db3a9788 100644 >> --- a/arch/riscv/mm/init.c >> +++ b/arch/riscv/mm/init.c >> @@ -124,10 +124,17 @@ void __init mem_init(void) >>   } >>   /* >> - * The default maximal physical memory size is -PAGE_OFFSET, >> - * limit the memory size via mem. >> + * The default maximal physical memory size is -PAGE_OFFSET for >> 32-bit kernel, >> + * whereas for 64-bit kernel, the end of the virtual address space is >> occupied >> + * by the modules/BPF/kernel mappings which reduces the available >> size of the >> + * linear mapping. >> + * Limit the memory size via mem. >>    */ >> +#ifdef CONFIG_64BIT >> +static phys_addr_t memory_limit = -PAGE_OFFSET - SZ_4G; >> +#else >>   static phys_addr_t memory_limit = -PAGE_OFFSET; >> +#endif >>   static int __init early_mem(char *p) >>   { > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv