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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BC76C0015E for ; Sun, 6 Aug 2023 10:09:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 591C86B0072; Sun, 6 Aug 2023 06:09:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51B156B0074; Sun, 6 Aug 2023 06:09:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E2DA6B0075; Sun, 6 Aug 2023 06:09:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 307B76B0072 for ; Sun, 6 Aug 2023 06:09:01 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0F22E1601D5 for ; Sun, 6 Aug 2023 10:09:01 +0000 (UTC) X-FDA: 81093256482.25.723848C Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by imf04.hostedemail.com (Postfix) with ESMTP id 279244000C for ; Sun, 6 Aug 2023 10:08:58 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of alex@ghiti.fr designates 217.70.183.195 as permitted sender) smtp.mailfrom=alex@ghiti.fr; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691316539; a=rsa-sha256; cv=none; b=DRg8+B57bLY0NE0xUfiZp3ECImO1oguEqCL7QI/Nn+ObhjrHHX7U1/Bt3oHg9OObFHL+hm pcDOGu+1nLcJ45uLDssmMaF0A6wL+QfSrU8xMB8hkhDgD6tfviuxA3TkW8efqVjXXbqvir cTlKyd8P7ojcD6jsNWpWvKTohb2/iiM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of alex@ghiti.fr designates 217.70.183.195 as permitted sender) smtp.mailfrom=alex@ghiti.fr; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691316539; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZGlK4YAV9XUXhQORVCJcgLK8KROZvCaIxsQnNJb9HGE=; b=4P/WBdF1k3XharEnKqW8kT/4KyFIU0UAbyR03WbsQiQ9uStvM9SSoY90CKrxExHmTFHS6w 7oQZLkHnUbCpZHRxgExqgif+ZH+iR8fGKG7/xuhnW0z9ZZBWym+PIQKTScDO0f9BE7Tssf cJN3eG7nvw13cEVNJTdpImtZpWgZtyo= Received: by mail.gandi.net (Postfix) with ESMTPSA id 4585960004; Sun, 6 Aug 2023 10:08:53 +0000 (UTC) Message-ID: Date: Sun, 6 Aug 2023 12:08:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v8 4/4] RISC-V: mm: Document mmap changes Content-Language: en-US To: Charlie Jenkins , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: conor@kernel.org, paul.walmsley@sifive.com, palmer@rivosinc.com, aou@eecs.berkeley.edu, anup@brainfault.org, konstantin@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, mick@ics.forth.gr, jrtc27@jrtc27.com, rdunlap@infradead.org, alexghiti@rivosinc.com References: <20230727212647.4182407-1-charlie@rivosinc.com> <20230727212647.4182407-5-charlie@rivosinc.com> From: Alexandre Ghiti In-Reply-To: <20230727212647.4182407-5-charlie@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 279244000C X-Stat-Signature: izewdn7h5cdqyxu3mxneo1cnszudu3xh X-HE-Tag: 1691316538-572828 X-HE-Meta: U2FsdGVkX18hDKqmgAZXnNpML3WDiqK3jHyv+SHNOhcjpcp6ERMXksBFcG78yfpSegLfbfhdP6w3NtsN3ys6y2CuLGGR2mI1swVKtgLCRIAXc4hebIpAYt501NFcgZzQIOKK4W9ujiqXYi5ulvK4P9tZTCYH92EJA3IKmAtgl4u/kYTOQ4Hgf3YJ2C5TMZBVgUC8gdRGaDH8v6fYuQMwqnA1sfVsumwRC3bp8Ne977Wzb0cDHqho/B2gW/kmFicFMW90oBrN6ugzyBB4/rpK1DQW5KP+1iCGfWRXmtClqFDnx/pvIS5nOnm4qBY1qlvvrys5mbco9+jGdln/F4ccvSpH3iGERsfl71+Fr17SMWPQHQDX/uD2vtOatZbKmL3eXCDdd0UMODMxxqkwgKXNuvmeueSWwJPC+Tgt1yeInTKPwe37c4k4aWzg/QHu6LuCc8VRwMyz8PfcEu8nSQ7EmOgwae0nnhWSc6wIyHAH+LRYd7TJVHrTsxyS8Xy51qjgCwwgiNvXmi3YqKz8ShSZeR0+Er2KTI0V6ViqvnZRVPYo8DJ9PYpEYgMKxQp3t7GbdNwVQaQdIpWiMV2Qc7QlGabO7QTvw2jqc4k6pzftVtHfZpjDDhAQR5hRaXvfa2ahBCLOwWkygYZGdDw3074QulNfiFvHklqf9njy5N48ElZQdBxoxaIqcmkdFWubFA2YmPhRI+1Mn3l/aLv6o+t2ITZ8e7YCqn0okXVU55VVJSp7T2qnsrF+bes4SGZrnlDzf7dSKZBK76FT/haMXW32iuzGLq+XCCq8//mIVj71EFo7LhCIKBjOD/aKj6pPpRlFF/yj4Nnk+yh4gKN7fcCJSpl3Bw/MwskVremrx/R9mxousQYdPrp0UtPJskXy7Cahol5OrmIcG69XAKMcmBb/A8euml1gHGMFOsgKfe/9swLoJJhMI1eIYWlz4AXgkO1NeyDxlby7AOJOjPmEEyX Yt4HbQYS z8Hu/+uFoqkZRsITRvVe4DDJytNsyPRnrA9l2uL1UcLGXHb8vvr3RtWuFFLxdtbfQXSA40bNpofHoyr4lNZoaPHVopKL6nd+teglg9rLNQtNIC50= X-Bogosity: Ham, tests=bogofilter, spamicity=0.011098, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 27/07/2023 23:26, Charlie Jenkins wrote: > The behavior of mmap is modified with this patch series, so explain the > changes to the mmap hint address behavior. > > Signed-off-by: Charlie Jenkins > --- > Documentation/riscv/vm-layout.rst | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst > index 5462c84f4723..69ff6da1dbf8 100644 > --- a/Documentation/riscv/vm-layout.rst > +++ b/Documentation/riscv/vm-layout.rst > @@ -133,3 +133,25 @@ RISC-V Linux Kernel SV57 > ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules, BPF > ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel > __________________|____________|__________________|_________|____________________________________________________________ > + > + > +Userspace VAs > +-------------------- > +To maintain compatibility with software that relies on the VA space with a > +maximum of 48 bits the kernel will, by default, return virtual addresses to > +userspace from a 48-bit range (sv48). This default behavior is achieved by > +passing 0 into the hint address parameter of mmap. On CPUs with an address space > +smaller than sv48, the CPU maximum supported address space will be the default. > + > +Software can "opt-in" to receiving VAs from another VA space by providing > +a hint address to mmap. A hint address passed to mmap will cause the largest > +address space that fits entirely into the hint to be used, unless there is no > +space left in the address space. If there is no space available in the requested > +address space, an address in the next smallest available address space will be > +returned. > + > +For example, in order to obtain 48-bit VA space, a hint address greater than > +:code:`1 << 47` must be provided. Note that this is 47 due to sv48 userspace > +ending at :code:`1 << 47` and the addresses beyond this are reserved for the > +kernel. Similarly, to obtain 57-bit VA space addresses, a hint address greater > +than or equal to :code:`1 << 56` must be provided. You can add: Reviewed-by: Alexandre Ghiti Thanks, Alex