From patchwork Wed Jan 31 01:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Jenkins X-Patchwork-Id: 13538463 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 A9775C47DDF for ; Wed, 31 Jan 2024 01:07:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 801716B0081; Tue, 30 Jan 2024 20:07:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 78BA96B0083; Tue, 30 Jan 2024 20:07:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67B4E6B0085; Tue, 30 Jan 2024 20:07:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 56ABB6B0081 for ; Tue, 30 Jan 2024 20:07:11 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 381A81A0C38 for ; Wed, 31 Jan 2024 01:07:11 +0000 (UTC) X-FDA: 81737817462.12.C8EF65D Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf27.hostedemail.com (Postfix) with ESMTP id 4258040012 for ; Wed, 31 Jan 2024 01:07:09 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CI5Z4vIL; spf=pass (imf27.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=charlie@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706663229; 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=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; b=mxFNEKDsZ6Jlha2Weii7MSazXiM+5o1TK2TzTagwDIHtL8KsKNpiA6hoNa9EjIoqrgkN1W C67WSee47e63XSV87WNr+EHmmF8P49jR6p+yfnfMeiWDhCwkD4dgRP2/W8IHSbq7LPNm82 NJQlvvScST9o7kLRqr+G5EU6IvYSdjQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706663229; a=rsa-sha256; cv=none; b=qHPIiaFLX9H6U+xM7ud2vya5nk1aPOoi9ei37JDgQ7PsRxdKD+3kzSX76Pl2bgwiiPLvCS zaEnXkZcqqes2t1lTGHl+orycvNg0qoVnaYXMaei0EOLiw8UTqdV9yOE5V5CnGR+Jjtoie DdxQgzlKFElZw3T1HmjAhvB4ozj2mPA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CI5Z4vIL; spf=pass (imf27.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=charlie@rivosinc.com; dmarc=none Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d746ce7d13so38370095ad.0 for ; Tue, 30 Jan 2024 17:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706663228; x=1707268028; darn=kvack.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; b=CI5Z4vILW/+g5KEt9eu2r1icAXOb2HwOcvjJIiVxkH21MHfgnfC/k6V8p9QH4dfDWD CtIIyrMQBQIMAAycf745tAAyzVk926ikskdLI/usOAxvx1UhM7Cs6a8WH6wZIZqj0Vg4 3eawIB2uYtpPywGhdZWBo6MvdMWz63BBzfcF07CZoI/MZALUzIyuUeOoc+cbvCmct7f6 8gL7fZxX7YylPD4oGvUqlDR9oozR3hQGv54hVxR4rM/1MllrV8/iqW8umrEP5+9LSsBX 8rhp0ODwHylVM54RcDWNoiLBGXeUYOZyQIo84KJoTiLIgThA8cMupKNto+jYDn92bN7D LbCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706663228; x=1707268028; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GGh1y1t0UhB5LcXiFRn0m1YgEny22RmTe/CDN12WiLQ=; b=M30LbC95W7PFS9/ssIXQTBwDyQ5YSepaa6kEYaEoaltrNSyM5sF/f9yvoWn5+gER34 xWF0EChJH3M8TfFAniOK518VsEnwifoOtG6V8+Zv0TCvJDuDPj7euF1ZZ8OUDV3Xl8+k G1AjG9kuL/KRxM8tPck3TQO8ERyLuirKZ+HE4QfirZygkc7LheI9GpMf4cp/wjp/yeox HhFs20GpdwPOtvp4P8GWsfDZMiHpVM5PFIeZC+2zKLBdkuNcd5NsOjV9JfseqYMegIWF 2yUDCsoyhL9YjfYmfBTN+lVEri48CkmsRm6HgVadHI5lPOgHYh5MZCkpg3hfzdZHhvIP 6Xgw== X-Gm-Message-State: AOJu0YxCgJlmq1ujDYxA3ubDccRcAjlB4ePe7LLQHE/HKsmkGLWeCBb9 X1vNPZHAcBMcq2AVWHrSde+OoNS/S+RkU38cH8SH4Bkqna0H9ara9dDBf/a+EFA= X-Google-Smtp-Source: AGHT+IEmbM/VilqQzN+bDSe1zgWZkRRaNPdWi6aSgLeBxKervvgWyww593Ha65RTd+Oj6JpwZn8mJA== X-Received: by 2002:a17:902:ed94:b0:1d7:310e:1e0d with SMTP id e20-20020a170902ed9400b001d7310e1e0dmr263865plj.32.1706663228198; Tue, 30 Jan 2024 17:07:08 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id r12-20020a170903410c00b001d8d3c276c4sm4970822pld.35.2024.01.30.17.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 17:07:07 -0800 (PST) From: Charlie Jenkins Date: Tue, 30 Jan 2024 17:07:02 -0800 Subject: [PATCH v3 3/3] docs: riscv: Define behavior of mmap MIME-Version: 1.0 Message-Id: <20240130-use_mmap_hint_address-v3-3-8a655cfa8bcb@rivosinc.com> References: <20240130-use_mmap_hint_address-v3-0-8a655cfa8bcb@rivosinc.com> In-Reply-To: <20240130-use_mmap_hint_address-v3-0-8a655cfa8bcb@rivosinc.com> To: Alexandre Ghiti , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan , Jonathan Corbet , Yangyu Chen Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706663222; l=1848; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=2lxtSNzBMdkYqwC90W41TvLPqjzE8CkjIf8iMq/P7L4=; b=VULcNJMPaGSSibunnHmdY8O6pSGdUfVoHdHqVkSZ/6IDh4hPdQyOg/2Va726eHw2pMLSxc0cG 87Fixe/YDGPCXhl08WlTq3vxGBa82+KW2s0J79eiJ6OVp8GW8Fgr/ii X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= X-Rspamd-Queue-Id: 4258040012 X-Rspam-User: X-Stat-Signature: p6a8ux474fkpjcj57z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ie+ynJM8CfPN7mn1TE4b7GfrT0ztK1s2InLRabIvV/UNvRnZSMdRGlcMtAvNMDmOOoI5M0GHPV6tgFfNJkmgHLz9JqY44d19aCRLHICbfMTncH2rIVO8vlVRy+G0zfuRzp6ejVoxUQmD3iNdOaxKFVQtXrAi1ZyP+RQCK0wx933xUjY7/yuf7UoOEGTsa+A8wxb09e2rjN1Mof146tn2XbFghXn6nmu3kgPmPs3kMPpx26LJ1z34Q0bWMOc74E7Ig5BEVzsQzR//RRhrnlXXkMLpBCeV9heFpokYrYlEzKnh6XExCqilL94FcluMrriXKgmSL/MlE4sjNNJ1FjHVFSlGTt9u95WpnXItp6YOKKmkrN6mifcJiM7gwZ0SKg5Ov75rAqvYn8/tiTvz877R02IxopFXkIkYCcX6Fk6mNEL135EiiJycHLT1ec7hoA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.115465, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Define mmap on riscv to not provide an address that uses more bits than the hint address, if provided. Signed-off-by: Charlie Jenkins --- Documentation/arch/riscv/vm-layout.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Documentation/arch/riscv/vm-layout.rst b/Documentation/arch/riscv/vm-layout.rst index 69ff6da1dbf8..e476b4386bd9 100644 --- a/Documentation/arch/riscv/vm-layout.rst +++ b/Documentation/arch/riscv/vm-layout.rst @@ -144,14 +144,8 @@ 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. +a hint address to mmap. When a hint address is passed to mmap, the returned +address will never use more bits than the hint address. For example, if a hint +address of `1 << 40` is passed to mmap, a valid returned address will never use +bits 41 through 63. If no mappable addresses are available in that range, mmap +will return `MAP_FAILED`.