linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Alexandre Ghiti <alex@ghiti.fr>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] riscv: Fix memory_limit for 64-bit kernel
Date: Thu, 1 Jul 2021 18:44:37 +0800	[thread overview]
Message-ID: <6a38fb9a-d658-836b-4ff4-7c47cadb7db0@huawei.com> (raw)
In-Reply-To: <20210629091349.3802690-1-alex@ghiti.fr>


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 :)

> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> ---
>   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)
>   {

  parent reply	other threads:[~2021-07-01 10:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  9:13 [PATCH 1/3] riscv: Fix memory_limit for 64-bit kernel Alexandre Ghiti
2021-06-29  9:13 ` [PATCH 2/3] riscv: Make sure the linear mapping does not use the kernel mapping Alexandre Ghiti
2021-06-29  9:13 ` [PATCH 3/3] riscv: Make sure the kernel mapping does not overlap with IS_ERR_VALUE Alexandre Ghiti
2021-07-24  0:58   ` Palmer Dabbelt
2021-07-26  5:47   ` Alex Ghiti
2021-07-01 10:44 ` Kefeng Wang [this message]
2021-07-01 19:01   ` [PATCH 1/3] riscv: Fix memory_limit for 64-bit kernel Alex Ghiti
2021-07-01 19:04     ` Alex Ghiti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a38fb9a-d658-836b-4ff4-7c47cadb7db0@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).