Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32724556rwd; Fri, 7 Jul 2023 20:32:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlGLZXebcBTLcy00ADIydiHe5m9qPE6+x/F1ZIyNQCgjwjQWTSM4zQnFsIDUEnKBvnqGUPDi X-Received: by 2002:a17:907:cca0:b0:98e:a451:fac3 with SMTP id up32-20020a170907cca000b0098ea451fac3mr4924521ejc.42.1688787172414; Fri, 07 Jul 2023 20:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688787172; cv=none; d=google.com; s=arc-20160816; b=Uj+IEz8z4aKPjG1mHtD8Fh3Tn7dVHCr24K/Wlw+F7A4rPCW0OJ3O1/CWbvFjf2lUgo BLQlzwk6ImZGxJkJ0AxEg5lveIpoiY2PYCK6JghVh1zDXRx6D97TfiGneGfYv0BiIuTe x8VorrENPKXttk7eCWc0rRQ/sJhD7X8ncurnDucmRnwJjg4B7l4a46SnY9EQgfwtqfFG meRxP+NWjy7fuM+r201mjMTcTKgCDczSfCZZXrOEYOjpJQmKwaNQnOyVv3is4kV9eTma dDhPNni6tRHVo3GPRaYS9pu9UY8hbHEOBJ027AFPLHacVA10t4Rjl2D4jq0oIshkMnLw +bsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=q+fKJg6HR9afiGS5ZVUkMqH6jNo2B3LjnZTFJ0ksF7M=; fh=bI4EvjRBL9mga6HRLJqVHPt2c0AVKDd8sfmDa1ORZAw=; b=dFOODFrYZSm3lU8J4qW+d/9lFZO9Z+sHZV8gxSl56JoyRgM6rXuk8mQLDMGEUb6D0Y tvxODGr7sPXh4K+ic0H9ZWtqGMVgOXp/AY2YMitQ0GLu1PFku4+gX2RJmbR+QU+20Yeq rme/WeLgrusLoEhdRFFvvQGeuEONivTn3wyLrnOqGJXaxin8c0boq1TctWsnGtbZS3Bf EdzQ7g0h+0swbSoISwFkDpzl3v+Q2caqUoOrZDWSGSBH1g1R6bqqV1o+r4EWsFtDeGkI t+O4m+P5xx/tag6ioGsyAOvWL+iTzKdAqeOsWCoOazILtTmjoZQooNoDYx+Pp2yq7TND C6iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=p0hZbb6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a1709063b0a00b00993199125d8si2911040ejf.378.2023.07.07.20.32.27; Fri, 07 Jul 2023 20:32:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=p0hZbb6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232907AbjGHDC6 (ORCPT + 99 others); Fri, 7 Jul 2023 23:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbjGHDC4 (ORCPT ); Fri, 7 Jul 2023 23:02:56 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F09FB1FEA; Fri, 7 Jul 2023 20:02:54 -0700 (PDT) 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-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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