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 47222C00528 for ; Sat, 8 Jul 2023 03:03:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E1BF6B0071; Fri, 7 Jul 2023 23:03:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 992206B0072; Fri, 7 Jul 2023 23:03:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 880AB8D0001; Fri, 7 Jul 2023 23:03:04 -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 796F36B0071 for ; Fri, 7 Jul 2023 23:03:04 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3D62AC017C for ; Sat, 8 Jul 2023 03:03:04 +0000 (UTC) X-FDA: 80986947888.26.D576DC2 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf14.hostedemail.com (Postfix) with ESMTP id C67F7100017 for ; Sat, 8 Jul 2023 03:03:00 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=p0hZbb6j; spf=none (imf14.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=rdunlap@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688785382; a=rsa-sha256; cv=none; b=2xH0g2wgQBp+Wf4t1lYzH+NLXh1ImjQ4F+ur4h+78SE8fQDQ+XnNSFAIbcBJzl8pIWeRKy lLM37UpnaNz05QbQQQIRG+iv/l4rpKeC0FuoGsPpFW1W/z9oCPehE4wblPK4GKjzlPlIQe 2bpuU1w3BSEz2LulTHmk2ti4zIJqN10= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=p0hZbb6j; spf=none (imf14.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=rdunlap@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688785382; 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:dkim-signature; bh=q+fKJg6HR9afiGS5ZVUkMqH6jNo2B3LjnZTFJ0ksF7M=; b=0XRe1DBNpVzE9gmgNKqmejYkOlGnI+Dz19fek3+b4HUg52MEsuxdluSwHITIHuw2qYGF9v zk7Q42/A2iKFlbDuvX7Woc9sblLrnkR+uiOX5yHTUi6M0RtmfQS0e2JffMXcbHy8EV0ycQ 3bKv8mrRweZfSthXaYyZFqCS1wdvjYI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=q+fKJg6HR9afiGS5ZVUkMqH6jNo2B3LjnZTFJ0ksF7M=; b=p0hZbb6jEJgI7kz5GD5aPJTIxg K5qlyeCab9L4xSs9SSpGF/0EgO6mRhDnh6fMTuGwZirQheHjG1QlF5eQW1cz44VptHS+NkRdfsEgW NJJ88fZhRgWzwCFs6xpd1RoiueA2g1RFFtoWWtVzgz9J+IEcVN9hfuy1Pfz3rZgdGSXpwqEQOX+aE kdZhFhKKxeGag+JOx6+HhToNSPjduhdgq0HEnCLJgtESF60hImYhtoRiao63uC1W5Osk/o9CM7Kho 2Ix3ZXTslu4bFUDZ8N/qkOkkVVWFoTEbv8TZgE1ig0n8rTHDOA+8vNpGi19/0JkBqS0XJotkJiUnJ kINsSWZw==; Received: from [2601:1c2:980:9ec0::2764] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qHyDl-006Oo9-1m; Sat, 08 Jul 2023 03:02:53 +0000 Message-ID: Date: Fri, 7 Jul 2023 20:02:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4 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 References: <20230708011156.2697409-1-charlie@rivosinc.com> <20230708011156.2697409-5-charlie@rivosinc.com> From: Randy Dunlap In-Reply-To: <20230708011156.2697409-5-charlie@rivosinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C67F7100017 X-Stat-Signature: uzy53ud5jdxy16wyni3aeche3493js56 X-Rspam-User: X-HE-Tag: 1688785380-963315 X-HE-Meta: U2FsdGVkX194lWXrETkNfKX30HodvAt7X3g5+CvMudaZQnxnkQrHbEDTJbiZ/xUYBYjz5N7ERAwCny2ExxyzPCB4wdEoC2nSWMuMO2YN0wbKtjN7FHjsHviEZYNnoMTOfsKfXGtrsKxlmxl7n5mhvZZ2fVrsv01/ugt66vJ1Unxp8SgAIOcvVPw3cE3grRcGnNx5E2i44qd6lhSkSbxAwYyIErzUO8kb5USFTqNZOr+Df9DoCyI37kNnFXceVnaLyfDf4hY7SgVh+qnh4AjxcBrCTkdChHufE4ndQwxUrEfwPW2tXjY8bEYHAVJX2H269hRnilyR8H0831v56RFhZ2zcuNsmb7JNLgvIZtxmmuim+HYVzF0kohCKtu/5+RHwckZLRmAAw0UN4cJccDPU5n2jhB9cnv80iIfGjBU+bYFy+qx+qr2uFbWBYxNPemtoZGH7iTnWjX35yK/mv0DeZzxpt69wJEL4MCRURut+SeSmxir6nZdhGBTPz6cQM18V8sM7jocv9agqftPMGg1RedfvncCb7UFn4HEBhMDMhZJy1BY5bISiq9UCOM0z3o0DwycJbpnciYO24Ms9lFcmQE1MsMYGSVy9bovAQrvgaz33rT6/hQcR2OKreQdTMBsCExr+V2r8MpdBzEd7i3fYQTkiXAYx9U0HrL4OJx4Qhlj/CvgfLFZGdx3g50YI99XqXQOeSKNJNYvMWTC6yVhipAfqmx/XpzElST5MrzFXqdOw0DgvtADJR36kGe7jZOgj4ap7hSlgWVwlfOCuBXsgkcoUXadPJmC60KYhAoJK/amUf5AMlePui515+HTWZwvYsiTRds2+YpTU9w1jZA+zmFIbFTqGLmFbu4Cp49MaoHs+3eXcQgG6lDszjIUBIDpj1ZwgeQLilRAA/WUWK8+DMwqKwom1nT9AuAUgx4Mww/vvg+udUN3C3N9dgOqU11btjuINeiapq9WXShpEntA ALUblVOo UM4i0r2Sh3RD1hPx1dTmc5LVv+P5xkbGI7M0hKAMt+bLfQht6ok0cxjlSO1gdjxYDSKSL8IhOL6Bk0MDlOroOWNnECwU1ZROFRXOz4gfhHn8uD/LmTB82Mf8MgUe7S1MCrThrP58RV5MtORp+m2VJC/qgMXg+7v92+l4Ua0YXFccif31XWz6l3UvmbSZ/C7ZBQy5nnfRCjLGH5NgIwGxZX4IdCPvBQrFsTYrOlPF8SFlBPf+vCvQ1AuXqsMWbUNdCYM6N 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: Hi-- On 7/7/23 18:11, 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..8141addbf888 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 other VA space by providing from another VA space or from other VA spaces I prefer the first one. > +a hint address to mmap. A call to mmap is guaranteed to return an address > +that will not override the unset left-aligned bits in the hint address, > +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 << 38` must be provided. Note that this is 38 due to sv39 userspace > +ending at :code:`1 << 38` 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 << 47` must be provided. -- ~Randy