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 CAB4BC001DF for ; Fri, 14 Jul 2023 00:14:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6D9F8E0005; Thu, 13 Jul 2023 20:14:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E1D9F8E0001; Thu, 13 Jul 2023 20:14:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBE068E0005; Thu, 13 Jul 2023 20:14:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B919F8E0001 for ; Thu, 13 Jul 2023 20:14:53 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8620F40415 for ; Fri, 14 Jul 2023 00:14:53 +0000 (UTC) X-FDA: 81008296866.01.7C4D30C Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf22.hostedemail.com (Postfix) with ESMTP id B2FFDC0007 for ; Fri, 14 Jul 2023 00:14:51 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=DK487UlE; dmarc=none; spf=pass (imf22.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=charlie@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689293691; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=7dKdw/fRpGMhPZx5yucAo2VmH/W0zeKNkjERAr97oOc=; b=gstVZtwxxElYXk0OJqHMV1NarzVZeyjNvzCINoFUkqGmXN30K6WzuUdCeNcJGzJW2CEUpM v6I4MEesHtL5+fseoc72lgCRi9pxNZYAKZ7w1kLeB07Fk1UKkT9Si7aN+Bxq+acFXxHZ08 I5ga5cRX6y6F0YUEQzg/+LxyvT/FeN0= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=DK487UlE; dmarc=none; spf=pass (imf22.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=charlie@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689293691; a=rsa-sha256; cv=none; b=FseDAfH/7uEQUim/W19shV4jzal1uUWWqK8oynkIO1PNJwnK7FAB9fzHI1CpCuu3ekXrjn y+nrMaLUI0mHdQgXoRVEMyWrFCpu9+Y/PdCpcoe6LJNtSdO+yLCvO6Rb6yT3CDkTpRb0KV 1WKhdGWny9tr3bLKeK90XyzPEcoo/wA= Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-668709767b1so982455b3a.2 for ; Thu, 13 Jul 2023 17:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1689293690; x=1689898490; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7dKdw/fRpGMhPZx5yucAo2VmH/W0zeKNkjERAr97oOc=; b=DK487UlEpW2G5KFRjrV2Qfjy60Qn/3kFcFt39vvQNjsEy/EdjOhr/PmBjKDr5CA3ue oNYqCOjXL+TSPHDxeqvlWpse/XFj2PCH5gOs1+zKgSASKGaJaZdpuXaFcEcq8Rnz3g+y ts2DnoxMIPwZa5nAYgO2k12ohjijX+QJLCxmRGkoqm7IiF1YhtJDNVLQLoyjr/QWeryV sLBQARcgGMGbDvBPNh+ho4raziT+pePlPpswVWZYtwuJDXPVf3INeH9eVA7RV0TqGEU+ p+gBY6VSbMqvdZfHFgkT4xA+5jHK7jye8x+ul57+5ybnNDFunisuInIaNp+Xb9wIXcyi quGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689293690; x=1689898490; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7dKdw/fRpGMhPZx5yucAo2VmH/W0zeKNkjERAr97oOc=; b=OUEnokHFAB/A4st26TOVh3ZwuL1DsMEkBsdQahFEhXnUfkwwbKZw/AWpz0tbQRcr3m fRo9rTOz+6k5OLud5+S2lOMIXlNzvShGuG2lUIPHud4CbiMg/fdZWtpw76U8HdK7huAE DrAEgcuWemM62Vy0MYScnv2kdMFstlYA9hmmMA+q5vBVp5IV2qRv73G/hJv6XxElt5Ry Bn4d6aY8vZ1m3uWJ51c1uUZUfSsUZG22IBhRdbPIwlntVvt+zK3+7a9tCG5npm5i9JBp ow62CFih/12C/wSKfFsZtHBM0gn3VPPxrDTuR52K8YpC5ZxdPvYEl+FyyE+3OueHLLwK QdLg== X-Gm-Message-State: ABy/qLas6slct2hjluEjlibfxilAQUqdg4ZsgWQAXs5YDb8aqx2Kkmff Wwr+d4NbVb/f7Se2tQVWQyYG2g== X-Google-Smtp-Source: APBJJlGnN8YBws+YDNmDKckQ6/RCNHOhLy80mxzCgKrfd+QSmAYMBcKo9f0Tl8SPbx+/J+Wj39dEBQ== X-Received: by 2002:a05:6a20:394f:b0:12f:952:11ee with SMTP id r15-20020a056a20394f00b0012f095211eemr2554686pzg.43.1689293690271; Thu, 13 Jul 2023 17:14:50 -0700 (PDT) Received: from charlie.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id x25-20020aa793b9000000b00673e652985esm5938107pff.44.2023.07.13.17.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 17:14:49 -0700 (PDT) From: Charlie Jenkins To: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: charlie@rivosinc.com, 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 Subject: [PATCH v5 0/4] RISC-V: mm: Make SV48 the default address space Date: Thu, 13 Jul 2023 17:13:59 -0700 Message-ID: <20230714001430.75798-1-charlie@rivosinc.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B2FFDC0007 X-Stat-Signature: od8s4jwahpoihzkroiix1j6utjs4hqb4 X-Rspam-User: X-HE-Tag: 1689293691-810532 X-HE-Meta: U2FsdGVkX19/N2HeBiwQg/Djb+zdeyHIhkzr51KmWYvM1wS3gZ7neNfPWua4RZP6Z4/ZXihpL8uidyTOzYXdtDi6B4yrUklzkQafSh2wf8pnib9e5I+859s6EUbPkeZ9zIGBoSkz2gMzc1r3jVagASFKVQjkyVXT1xRBtXN8gLlf8RNIuAoG8etEblSzwe1ul6CwRVBB7Hn7PNaExsAqbZaoYL2cpGCv3vGFY6+vjTDzAlbZyEEV2iZVygDxsuckKwBJgWbo7TdLgfddCONaNEgg9TQRECl0XV58C4ZWuY/YkHyplDa58hOfaA8wKVRBPeHYbF+eGFl7SfHnziYJnXAYeTGpUya56TQtO39qwdSBzXPUs2NMHci3YNLtYeFFe/TjVsFVx/6wQFdEY3oBfnMmpC/HO2gndizZoyFW3HQYoDstdyfJFcr5mT/joRQSskTgk81vrmDIRnIfDK+SvUSUFtybWblcAl+pNJKy+wrvqzlhe/Shd3rTIf2NyQkVs5gUaskbUAyUj/DgF27frH5JhWZBHR5Ob/5XcMow7SeCkNjlAOM6IjNreBa96RRGtxfY9MAEDU4fIV738Y9tc53gjYm/s2TJIdOSnQtsLrntLkBkZGf/KqE/urnSal3URQNkMFrPxgxFFfqGBVrlGGCX/6uDG3psAe/2fLEs/cDv/VKqwQBGdBbz/nmtmu9VVKHXzyw0zTe1cBLSKUgOFE48G2MX6PRlkF2YfRGbEVriUsAl9pbYwSQsEcLdzw7MhspiL0bQ06c1/fjBm8nzq3J+591jdNxV6O04SVIx50HUknur4W47DgcsN2MNTa7IPuGG33AuPxlh3Bq3QyBfJ4M5mB4A5JxoNYUxTTZ3FylHYZYWyd9F340THRnEJH+gdPmWGLBE8xG+ZTRhaER2WhSqG8etkmoBGmG+udAP57jc0hJm4ENbkwdDustheih59L7YCVDn5LVdhOvCz8H GgX0pUjC a76Ly70nDOV8kUEJ0Pes1Xmyfvl8JHnWCt3oWjWQQfywsNwbNO5VE9UUzZzI1ZWss2a5YocZcaWdxGZcZg2jOgrezH8Xr+Sv/q7EgtltSGz71QNyg/Mi1Gu2ER5962aEmqA+rc4EScWuM4P+hKeOc6bYbO5yQWnbWZIojlHLszOgN/vLshVXOxJkkrkp3pKviH57WQKrumtjM16DhHe/Orr69zn2CzWczFw2KaZmbUfwUEO+I5NfUXLJlHXNBySzHKcyimZjCKFmlK+uYsNFuT4Q6ZRMvzZp11dnCTPUZn5h864lWQv3DhMg7EnfOK7owKgQT9T0YNVHSsSI0zMLiw5AmteNfSktSzXQ+jA8RJa40g+dZjGHx0WEKpdnYqKksvszKo667BPiSVcw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000828, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Make sv48 the default address space for mmap as some applications currently depend on this assumption. Users can now select a desired address space using a non-zero hint address to mmap. Previously, requesting the default address space from mmap by passing zero as the hint address would result in using the largest address space possible. Some applications depend on empty bits in the virtual address space, like Go and Java, so this patch provides more flexibility for application developers. -Charlie --- v5: - Minor wording change in documentation - Change some parenthesis in arch_get_mmap_ macros - Added case for addr==0 in arch_get_mmap_ because without this, programs would crash if RLIMIT_STACK was modified before executing the program. This was tested using the libhugetlbfs tests. v4: - Split testcases/document patch into test cases, in-code documentation, and formal documentation patches - Modified the mmap_base macro to be more legible and better represent memory layout - Fixed documentation to better reflect the implmentation - Renamed DEFAULT_VA_BITS to MMAP_VA_BITS - Added additional test case for rlimit changes --- Charlie Jenkins (4): RISC-V: mm: Restrict address space for sv39,sv48,sv57 RISC-V: mm: Add tests for RISC-V mm RISC-V: mm: Update pgtable comment documentation RISC-V: mm: Document mmap changes Documentation/riscv/vm-layout.rst | 22 +++ arch/riscv/include/asm/elf.h | 2 +- arch/riscv/include/asm/pgtable.h | 20 ++- arch/riscv/include/asm/processor.h | 46 +++++- tools/testing/selftests/riscv/Makefile | 2 +- tools/testing/selftests/riscv/mm/.gitignore | 1 + tools/testing/selftests/riscv/mm/Makefile | 21 +++ .../selftests/riscv/mm/testcases/mmap.c | 133 ++++++++++++++++++ 8 files changed, 234 insertions(+), 13 deletions(-) create mode 100644 tools/testing/selftests/riscv/mm/.gitignore create mode 100644 tools/testing/selftests/riscv/mm/Makefile create mode 100644 tools/testing/selftests/riscv/mm/testcases/mmap.c -- 2.41.0