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 D7549EB64D9 for ; Thu, 6 Jul 2023 05:30:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 706EB8D0002; Thu, 6 Jul 2023 01:30:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B6E48D0001; Thu, 6 Jul 2023 01:30:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57E988D0002; Thu, 6 Jul 2023 01:30:16 -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 48D908D0001 for ; Thu, 6 Jul 2023 01:30:16 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id ECB8140256 for ; Thu, 6 Jul 2023 05:30:15 +0000 (UTC) X-FDA: 80980061190.22.DFC844B Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf02.hostedemail.com (Postfix) with ESMTP id 939738000A for ; Thu, 6 Jul 2023 05:30:12 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=u4VkgAOo; dmarc=none; spf=none (imf02.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=rdunlap@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688621413; 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=tdQdAo2qFTj9DGBuoLP2bbCYlpn9+aYrsvBc/jj9Rf8=; b=x20WwKoz1jYiYuO5zbwnf/yOJtOoOo/pfTI4GWVjf3wHVSFGPde2g0XjtgJKXzA9D31Nxn 7zbroWTkISwE2OehUUEeu0g1rVpyfqv9qbhNvkLXJ8aewNCc7iYC1hf+77Btozuxt6cFLv xB6C6zDcPfxkzgtSqbaC/nzvJQOCXzU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=u4VkgAOo; dmarc=none; spf=none (imf02.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=rdunlap@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688621413; a=rsa-sha256; cv=none; b=DvGhDXNxc5pv7fFjHsACSTOG1pGuzKWPOvsfK4wCeWfwhuxZFRvn4ZRmcdjT06XK0dq3av ljPnc21ya+otztEEATbJ2aEcMcoOC7hCoDfGrDqjk1sLD/Vk6Z/L+pk8nBzXdRUwr5CAgi e3sA7xKDPwFe3gIS+i2Q4IMno6GtzPE= 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=tdQdAo2qFTj9DGBuoLP2bbCYlpn9+aYrsvBc/jj9Rf8=; b=u4VkgAOorIJnIks7BeD4quSFTl ISGBFW6rKQ/t2PCT2iUGMw5XoZCSTI73o0HG1Ow7DLVUlRSCNP7NCrva+xHeUJJGlR9047v4XLOCt M5wzogth/xpQ1WAooFH5OIc7wIK07fz/D6pjjx0Pvqfb7b5envA4VuM+v6535aMJEVQ2AVchMopCN ohURXs3HMho+WOF79xj3MTLacTTEzUGzpZsXuCid00fuZRV4PtUYa2MfQJ+dbum+RcHG83Jsrit9M Itt8fANfH8AO2G3tI9Fa7XRmsuLj51T+B1qoIMueE1HzKCg6IyVwblWb1ZoSrLLzQk3eK6ekuHJ8e 5XCzkzjA==; Received: from [2601:1c2:980:9ec0::2764] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qHHZ5-000UqT-21; Thu, 06 Jul 2023 05:30:03 +0000 Message-ID: Date: Wed, 5 Jul 2023 22:30:02 -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: [RESEND PATCH v3 2/2] RISC-V: mm: Update documentation and include test 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: <20230705190002.384799-1-charlie@rivosinc.com> <20230705190002.384799-3-charlie@rivosinc.com> Content-Language: en-US From: Randy Dunlap In-Reply-To: <20230705190002.384799-3-charlie@rivosinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 939738000A X-Stat-Signature: fddcei9csfoa4kraf5i5tt5rmgy11a8n X-Rspam-User: X-HE-Tag: 1688621412-454431 X-HE-Meta: U2FsdGVkX18esfvgtWj/qvcfroZKRtKr3KcWbHBP0WBBaxyrlfjGH1BRPYBoWSvC1e5g7FEtbRHgzUCbn/evMJyAqDKpHXIkW2wXm/GOdbLX0tTD441MOa5SWP92jeGhqoQKQy6hAgAMGOgBOG7Te4tN31WAN7THJgaMQPbl5ewoZgaIzP8GHwioZe5iOrLiOceD2tlHGpq/KPseIBKGFpScfetZ9rrvfcwRoUn7dHQgY3i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Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi-- On 7/5/23 11:59, Charlie Jenkins wrote: > Add documentation explaining the behavior of mmap. Include > a simple test that ensures that mmap returns an address less > than the hint address while there are still addresses available. > > Signed-off-by: Charlie Jenkins > --- > Documentation/riscv/vm-layout.rst | 22 +++++++++ > arch/riscv/include/asm/pgtable.h | 8 +-- > 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 | 49 +++++++++++++++++++ > 6 files changed, 99 insertions(+), 4 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 > > diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst > index 5462c84f4723..a610c68c9f3f 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 39-bits, the kernel will, by default, return virtual 39 bits, > +return virtual addresses to userspace from a 48-bit range (sv48). This ^^ duplicate "return virtual" > +default behavior is achieved by passing 0 into the hint address parameter > +of mmap. > + > diff --git a/tools/testing/selftests/riscv/mm/.gitignore b/tools/testing/selftests/riscv/mm/.gitignore > new file mode 100644 > index 000000000000..022ea0a3f7df > --- /dev/null > +++ b/tools/testing/selftests/riscv/mm/.gitignore > @@ -0,0 +1 @@ > +mmap > \ No newline at end of file add a newline, please. > diff --git a/tools/testing/selftests/riscv/mm/Makefile b/tools/testing/selftests/riscv/mm/Makefile > new file mode 100644 > index 000000000000..d41a0b3d2ca2 > --- /dev/null > +++ b/tools/testing/selftests/riscv/mm/Makefile > @@ -0,0 +1,21 @@ > +# SPDX-License-Identifier: GPL-2.0 > +# Originally tools/testing/selftests/arm64/signal > + > +# Additional include paths needed by kselftest.h and local headers > +CFLAGS += -D_GNU_SOURCE -std=gnu99 -I. > + > +SRCS := $(filter-out testcases/testcases.c,$(wildcard testcases/*.c)) > +PROGS := $(patsubst %.c,%,$(SRCS)) > + > +# Generated binaries to be installed by top KSFT script > +TEST_GEN_PROGS := $(notdir $(PROGS)) > + > +# Get Kernel headers installed and use them. > + > +# Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list > +# to account for any OUTPUT target-dirs optionally provided by > +# the toplevel makefile > +include ../../lib.mk > + > +$(TEST_GEN_PROGS): $(PROGS) > + cp $(PROGS) $(OUTPUT)/ > \ No newline at end of file add a newline, please. -- ~Randy