All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] selftests/mm: Implement support for arm64 on va
@ 2023-03-23 10:52 Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 1/5] selftests/mm: Add support for arm64 platform on va switch Chaitanya S Prakash
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-03-23 10:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Chaitanya S Prakash, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

The va_128TBswitch selftest is designed and implemented for PowerPC and
x86 architectures which support a 128TB switch, up to 256TB of virtual
address space and hugepage sizes of 16MB and 2MB respectively. Arm64
platforms on the other hand support a 256Tb switch, up to 4PB of virtual
address space and a default hugepage size of 512MB when 64k pagesize is
enabled.

These architectural differences require introducing support for arm64
platforms, after which a more generic naming convention is suggested.
The in code comments are amended to provide a more platform independent
explanation of the working of the code and nr_hugepages are configured
as required. Finally, the file running the testcase is modified in order
to prevent skipping of hugetlb testcases of va_high_addr_switch.

This series has been tested on 6.3.0-rc3 kernel, both on arm64 and x86
platforms.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org 

Chaitanya S Prakash (5):
  selftests/mm: Add support for arm64 platform on va switch
  selftests/mm: Rename va_128TBswitch to va_high_addr_switch
  selftests/mm: Add platform independent in code comments
  selftests/mm: Configure nr_hugepages for arm64
  selftests/mm: Run hugetlb testcases of va switch

 tools/testing/selftests/mm/Makefile           |  4 +-
 tools/testing/selftests/mm/run_vmtests.sh     | 12 +++++-
 ...va_128TBswitch.c => va_high_addr_switch.c} | 41 +++++++++++++++----
 ..._128TBswitch.sh => va_high_addr_switch.sh} |  6 ++-
 4 files changed, 49 insertions(+), 14 deletions(-)
 rename tools/testing/selftests/mm/{va_128TBswitch.c => va_high_addr_switch.c} (86%)
 rename tools/testing/selftests/mm/{va_128TBswitch.sh => va_high_addr_switch.sh} (89%)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] selftests/mm: Add support for arm64 platform on va switch
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
@ 2023-03-23 10:52 ` Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 2/5] selftests/mm: Rename va_128TBswitch to va_high_addr_switch Chaitanya S Prakash
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-03-23 10:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Chaitanya S Prakash, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

Arm64 platforms have the ability to support 64kb pagesize, 512MB default
hugepage size and up to 4PB of virtual address space. The address switch
occurs at 256TB as opposed to 128TB. Hence, the necessary support has
been added.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org 
Signed-off-by: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
---
 tools/testing/selftests/mm/va_128TBswitch.c | 26 +++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/mm/va_128TBswitch.c b/tools/testing/selftests/mm/va_128TBswitch.c
index 1d2068989883..6679213effed 100644
--- a/tools/testing/selftests/mm/va_128TBswitch.c
+++ b/tools/testing/selftests/mm/va_128TBswitch.c
@@ -17,6 +17,13 @@
  * This will work with 16M and 2M hugepage size
  */
 #define HUGETLB_SIZE	(16 << 20)
+#elif __aarch64__
+/*
+ * The default hugepage size for 64k base pagesize
+ * is 512MB.
+ */
+#define PAGE_SIZE	(64 << 10)
+#define HUGETLB_SIZE	(512 << 20)
 #else
 #define PAGE_SIZE	(4 << 10)
 #define HUGETLB_SIZE	(2 << 20)
@@ -26,9 +33,22 @@
  * >= 128TB is the hint addr value we used to select
  * large address space.
  */
-#define ADDR_SWITCH_HINT (1UL << 47)
+
+#define ADDR_MARK_128TB	(1UL << 47)
+#define ADDR_MARK_256TB	(1UL << 48)
+
+#define HIGH_ADDR_128TB	((void *) (1UL << 48))
+#define HIGH_ADDR_256TB	((void *) (1UL << 49))
+
 #define LOW_ADDR	((void *) (1UL << 30))
-#define HIGH_ADDR	((void *) (1UL << 48))
+
+#ifdef __aarch64__
+#define ADDR_SWITCH_HINT ADDR_MARK_256TB
+#define HIGH_ADDR	 HIGH_ADDR_256TB
+#else
+#define ADDR_SWITCH_HINT ADDR_MARK_128TB
+#define HIGH_ADDR	 HIGH_ADDR_128TB
+#endif
 
 struct testcase {
 	void *addr;
@@ -270,6 +290,8 @@ static int supported_arch(void)
 	return 1;
 #elif defined(__x86_64__)
 	return 1;
+#elif defined(__aarch64__)
+	return 1;
 #else
 	return 0;
 #endif
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] selftests/mm: Rename va_128TBswitch to va_high_addr_switch
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 1/5] selftests/mm: Add support for arm64 platform on va switch Chaitanya S Prakash
@ 2023-03-23 10:52 ` Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 3/5] selftests/mm: Add platform independent in code comments Chaitanya S Prakash
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-03-23 10:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Chaitanya S Prakash, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

As the initial selftest only took into consideration PowperPC and x86
architectures, on adding support for arm64, a platform independent
naming convention is chosen.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org 
Signed-off-by: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
---
 tools/testing/selftests/mm/Makefile                           | 4 ++--
 tools/testing/selftests/mm/run_vmtests.sh                     | 2 +-
 .../selftests/mm/{va_128TBswitch.c => va_high_addr_switch.c}  | 0
 .../mm/{va_128TBswitch.sh => va_high_addr_switch.sh}          | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
 rename tools/testing/selftests/mm/{va_128TBswitch.c => va_high_addr_switch.c} (100%)
 rename tools/testing/selftests/mm/{va_128TBswitch.sh => va_high_addr_switch.sh} (98%)

diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index c31d952cff68..1246552d4b86 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -91,7 +91,7 @@ endif
 endif
 
 ifneq (,$(filter $(MACHINE),arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sh64 sparc64 x86_64))
-TEST_GEN_FILES += va_128TBswitch
+TEST_GEN_FILES += va_high_addr_switch
 TEST_GEN_FILES += virtual_address_range
 TEST_GEN_FILES += write_to_hugetlbfs
 endif
@@ -100,7 +100,7 @@ TEST_PROGS := run_vmtests.sh
 
 TEST_FILES := test_vmalloc.sh
 TEST_FILES += test_hmm.sh
-TEST_FILES += va_128TBswitch.sh
+TEST_FILES += va_high_addr_switch.sh
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index 8984e0bb58c7..eb9823a6959a 100644
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -223,7 +223,7 @@ if [ $VADDR64 -ne 0 ]; then
 	CATEGORY="hugevm" run_test ./virtual_address_range
 
 	# virtual address 128TB switch test
-	CATEGORY="hugevm" run_test ./va_128TBswitch.sh
+	CATEGORY="hugevm" run_test ./va_high_addr_switch.sh
 fi # VADDR64
 
 # vmalloc stability smoke test
diff --git a/tools/testing/selftests/mm/va_128TBswitch.c b/tools/testing/selftests/mm/va_high_addr_switch.c
similarity index 100%
rename from tools/testing/selftests/mm/va_128TBswitch.c
rename to tools/testing/selftests/mm/va_high_addr_switch.c
diff --git a/tools/testing/selftests/mm/va_128TBswitch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh
similarity index 98%
rename from tools/testing/selftests/mm/va_128TBswitch.sh
rename to tools/testing/selftests/mm/va_high_addr_switch.sh
index 41580751dc51..3056788a27ac 100644
--- a/tools/testing/selftests/mm/va_128TBswitch.sh
+++ b/tools/testing/selftests/mm/va_high_addr_switch.sh
@@ -51,4 +51,4 @@ check_test_requirements()
 }
 
 check_test_requirements
-./va_128TBswitch
+./va_high_addr_switch
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] selftests/mm: Add platform independent in code comments
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 1/5] selftests/mm: Add support for arm64 platform on va switch Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 2/5] selftests/mm: Rename va_128TBswitch to va_high_addr_switch Chaitanya S Prakash
@ 2023-03-23 10:52 ` Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 4/5] selftests/mm: Configure nr_hugepages for arm64 Chaitanya S Prakash
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-03-23 10:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Chaitanya S Prakash, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

The in code comments for the selftest were made on the basis of 128TB
switch, an architecture feature specific to PowerPc and x86 platforms.
Keeping in mind the support added for arm64 platforms which implements
a 256TB switch, a more generic explanation has been provided.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org 
Signed-off-by: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
---
 tools/testing/selftests/mm/va_high_addr_switch.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/mm/va_high_addr_switch.c b/tools/testing/selftests/mm/va_high_addr_switch.c
index 6679213effed..7cfaf4a74c57 100644
--- a/tools/testing/selftests/mm/va_high_addr_switch.c
+++ b/tools/testing/selftests/mm/va_high_addr_switch.c
@@ -30,8 +30,8 @@
 #endif
 
 /*
- * >= 128TB is the hint addr value we used to select
- * large address space.
+ * The hint addr value is used to allocate addresses
+ * beyond the high address switch boundary.
  */
 
 #define ADDR_MARK_128TB	(1UL << 47)
@@ -73,9 +73,10 @@ static struct testcase testcases[] = {
 	},
 	{
 		/*
-		 * We should never allocate at the requested address or above it
-		 * The len cross the 128TB boundary. Without MAP_FIXED
-		 * we will always search in the lower address space.
+		 * Unless MAP_FIXED is specified, allocation based on hint
+		 * addr is never at requested address or above it, which is
+		 * beyond high address switch boundary in this case. Instead,
+		 * a suitable allocation is found in lower address space.
 		 */
 		.addr = ((void *)(ADDR_SWITCH_HINT - PAGE_SIZE)),
 		.size = 2 * PAGE_SIZE,
@@ -85,8 +86,8 @@ static struct testcase testcases[] = {
 	},
 	{
 		/*
-		 * Exact mapping at 128TB, the area is free we should get that
-		 * even without MAP_FIXED.
+		 * Exact mapping at high address switch boundary, should
+		 * be obtained even without MAP_FIXED as area is free.
 		 */
 		.addr = ((void *)(ADDR_SWITCH_HINT)),
 		.size = PAGE_SIZE,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] selftests/mm: Configure nr_hugepages for arm64
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
                   ` (2 preceding siblings ...)
  2023-03-23 10:52 ` [PATCH 3/5] selftests/mm: Add platform independent in code comments Chaitanya S Prakash
@ 2023-03-23 10:52 ` Chaitanya S Prakash
  2023-03-23 10:52 ` [PATCH 5/5] selftests/mm: Run hugetlb testcases of va switch Chaitanya S Prakash
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-03-23 10:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Chaitanya S Prakash, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

Arm64 has a default hugepage size of 512MB when CONFIG_ARM64_64K_PAGES=y
is enabled. While testing on arm64 platforms having up to 4PB of virtual
address space, a minimum of 6 hugepages were required for all test cases
to pass. Support for this requirement has been added.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org 
Signed-off-by: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
---
 tools/testing/selftests/mm/run_vmtests.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index eb9823a6959a..7616b3e4a0f0 100644
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -222,8 +222,16 @@ CATEGORY="hugetlb" run_test ./thuge-gen
 if [ $VADDR64 -ne 0 ]; then
 	CATEGORY="hugevm" run_test ./virtual_address_range
 
-	# virtual address 128TB switch test
+	# va high address boundary switch test
+	ARCH_ARM64="arm64"
+	prev_nr_hugepages=$(cat /proc/sys/vm/nr_hugepages)
+	if [ "$ARCH" == "$ARCH_ARM64" ]; then
+		echo 6 > /proc/sys/vm/nr_hugepages
+	fi
 	CATEGORY="hugevm" run_test ./va_high_addr_switch.sh
+	if [ "$ARCH" == "$ARCH_ARM64" ]; then
+		echo $prev_nr_hugepages > /proc/sys/vm/nr_hugepages
+	fi
 fi # VADDR64
 
 # vmalloc stability smoke test
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] selftests/mm: Run hugetlb testcases of va switch
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
                   ` (3 preceding siblings ...)
  2023-03-23 10:52 ` [PATCH 4/5] selftests/mm: Configure nr_hugepages for arm64 Chaitanya S Prakash
@ 2023-03-23 10:52 ` Chaitanya S Prakash
  2023-03-23 11:14 ` [PATCH 0/5] selftests/mm: Implement support for arm64 on va Kirill A. Shutemov
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-03-23 10:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Chaitanya S Prakash, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

The va_high_addr_switch selftest is used to test mmap across 128TB
boundary. It divides the selftest cases into two main categories on
the basis of size. One set is used to create mappings that are multiples
of PAGE_SIZE while the other creates mappings that are multiples of
HUGETLB_SIZE.

In order to run the hugetlb testcases the binary must be appended with
"--run-hugetlb" but the file that used to run the test only invokes the
binary, thereby completely skipping the hugetlb testcases. Hence, the
required statement has been added.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org 
Signed-off-by: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
---
 tools/testing/selftests/mm/va_high_addr_switch.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/mm/va_high_addr_switch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh
index 3056788a27ac..45cae7cab27e 100644
--- a/tools/testing/selftests/mm/va_high_addr_switch.sh
+++ b/tools/testing/selftests/mm/va_high_addr_switch.sh
@@ -52,3 +52,7 @@ check_test_requirements()
 
 check_test_requirements
 ./va_high_addr_switch
+
+# In order to run hugetlb testcases, "--run-hugetlb" must be appended
+# to the binary.
+./va_high_addr_switch --run-hugetlb
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] selftests/mm: Implement support for arm64 on va
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
                   ` (4 preceding siblings ...)
  2023-03-23 10:52 ` [PATCH 5/5] selftests/mm: Run hugetlb testcases of va switch Chaitanya S Prakash
@ 2023-03-23 11:14 ` Kirill A. Shutemov
  2023-03-23 11:59   ` Mark Rutland
  2023-03-23 21:49 ` Andrew Morton
  2023-04-05  4:22 ` Chaitanya S Prakash
  7 siblings, 1 reply; 11+ messages in thread
From: Kirill A. Shutemov @ 2023-03-23 11:14 UTC (permalink / raw)
  To: Chaitanya S Prakash
  Cc: linux-mm, linux-kernel, Andrew Morton, Aneesh Kumar K . V,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

On Thu, Mar 23, 2023 at 04:22:38PM +0530, Chaitanya S Prakash wrote:
> The va_128TBswitch selftest is designed and implemented for PowerPC and
> x86 architectures which support a 128TB switch, up to 256TB of virtual
> address space and hugepage sizes of 16MB and 2MB respectively. Arm64
> platforms on the other hand support a 256Tb switch, up to 4PB of virtual
> address space and a default hugepage size of 512MB when 64k pagesize is
> enabled.
> 
> These architectural differences require introducing support for arm64
> platforms, after which a more generic naming convention is suggested.
> The in code comments are amended to provide a more platform independent
> explanation of the working of the code and nr_hugepages are configured
> as required. Finally, the file running the testcase is modified in order
> to prevent skipping of hugetlb testcases of va_high_addr_switch.
> 
> This series has been tested on 6.3.0-rc3 kernel, both on arm64 and x86
> platforms.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kselftest@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org 
> 
> Chaitanya S Prakash (5):
>   selftests/mm: Add support for arm64 platform on va switch
>   selftests/mm: Rename va_128TBswitch to va_high_addr_switch
>   selftests/mm: Add platform independent in code comments
>   selftests/mm: Configure nr_hugepages for arm64
>   selftests/mm: Run hugetlb testcases of va switch
> 
>  tools/testing/selftests/mm/Makefile           |  4 +-
>  tools/testing/selftests/mm/run_vmtests.sh     | 12 +++++-
>  ...va_128TBswitch.c => va_high_addr_switch.c} | 41 +++++++++++++++----
>  ..._128TBswitch.sh => va_high_addr_switch.sh} |  6 ++-
>  4 files changed, 49 insertions(+), 14 deletions(-)
>  rename tools/testing/selftests/mm/{va_128TBswitch.c => va_high_addr_switch.c} (86%)
>  rename tools/testing/selftests/mm/{va_128TBswitch.sh => va_high_addr_switch.sh} (89%)

The patchset looks sane to me, but I have question: why arm64 has switch
on 256TB. The reason we have the switch is to keep system backward
compatible.

Maybe it is better to make arm64 switch also on 128TB to make it
compatible across architectures?

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] selftests/mm: Implement support for arm64 on va
  2023-03-23 11:14 ` [PATCH 0/5] selftests/mm: Implement support for arm64 on va Kirill A. Shutemov
@ 2023-03-23 11:59   ` Mark Rutland
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Rutland @ 2023-03-23 11:59 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Chaitanya S Prakash, linux-mm, linux-kernel, Andrew Morton,
	Aneesh Kumar K . V, Kirill A . Shutemov, Shuah Khan,
	linux-kselftest

On Thu, Mar 23, 2023 at 02:14:36PM +0300, Kirill A. Shutemov wrote:
> On Thu, Mar 23, 2023 at 04:22:38PM +0530, Chaitanya S Prakash wrote:
> > The va_128TBswitch selftest is designed and implemented for PowerPC and
> > x86 architectures which support a 128TB switch, up to 256TB of virtual
> > address space and hugepage sizes of 16MB and 2MB respectively. Arm64
> > platforms on the other hand support a 256Tb switch, up to 4PB of virtual
> > address space and a default hugepage size of 512MB when 64k pagesize is
> > enabled.
> > 
> > These architectural differences require introducing support for arm64
> > platforms, after which a more generic naming convention is suggested.
> > The in code comments are amended to provide a more platform independent
> > explanation of the working of the code and nr_hugepages are configured
> > as required. Finally, the file running the testcase is modified in order
> > to prevent skipping of hugetlb testcases of va_high_addr_switch.
> > 
> > This series has been tested on 6.3.0-rc3 kernel, both on arm64 and x86
> > platforms.
> > 
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Shuah Khan <shuah@kernel.org>
> > Cc: linux-mm@kvack.org
> > Cc: linux-kselftest@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org 
> > 
> > Chaitanya S Prakash (5):
> >   selftests/mm: Add support for arm64 platform on va switch
> >   selftests/mm: Rename va_128TBswitch to va_high_addr_switch
> >   selftests/mm: Add platform independent in code comments
> >   selftests/mm: Configure nr_hugepages for arm64
> >   selftests/mm: Run hugetlb testcases of va switch
> > 
> >  tools/testing/selftests/mm/Makefile           |  4 +-
> >  tools/testing/selftests/mm/run_vmtests.sh     | 12 +++++-
> >  ...va_128TBswitch.c => va_high_addr_switch.c} | 41 +++++++++++++++----
> >  ..._128TBswitch.sh => va_high_addr_switch.sh} |  6 ++-
> >  4 files changed, 49 insertions(+), 14 deletions(-)
> >  rename tools/testing/selftests/mm/{va_128TBswitch.c => va_high_addr_switch.c} (86%)
> >  rename tools/testing/selftests/mm/{va_128TBswitch.sh => va_high_addr_switch.sh} (89%)
> 
> The patchset looks sane to me, but I have question: why arm64 has switch
> on 256TB. The reason we have the switch is to keep system backward
> compatible.

It's the same reason, it's just that arm64 initially supported 48-bits / 256TB
of user addresses (0x0000000000000000..0x0000ffffffffffff), while x86_64
supported 47-bits / 128TB (0x0000000000000000..0x00007fffffffffff).

Note: arm64 has separate page tables for the user / kernel halves of the VA
space, which in practice means we get an extra bit of address range for each
half.

> Maybe it is better to make arm64 switch also on 128TB to make it
> compatible across architectures?

I don't think that's something that we can change; user addresses between 128TB
and 256TB have been the case for over a decade now, and avoiding that by
default could easily break something.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] selftests/mm: Implement support for arm64 on va
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
                   ` (5 preceding siblings ...)
  2023-03-23 11:14 ` [PATCH 0/5] selftests/mm: Implement support for arm64 on va Kirill A. Shutemov
@ 2023-03-23 21:49 ` Andrew Morton
  2023-03-24 10:15   ` Anshuman Khandual
  2023-04-05  4:22 ` Chaitanya S Prakash
  7 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2023-03-23 21:49 UTC (permalink / raw)
  To: Chaitanya S Prakash
  Cc: linux-mm, linux-kernel, Aneesh Kumar K . V, Kirill A . Shutemov,
	Shuah Khan, linux-kselftest

On Thu, 23 Mar 2023 16:22:38 +0530 Chaitanya S Prakash <chaitanyas.prakash@arm.com> wrote:

> The va_128TBswitch selftest is designed and implemented for PowerPC and
> x86 architectures which support a 128TB switch, up to 256TB of virtual
> address space and hugepage sizes of 16MB and 2MB respectively. Arm64
> platforms on the other hand support a 256Tb switch, up to 4PB of virtual
> address space and a default hugepage size of 512MB when 64k pagesize is
> enabled.
> 
> These architectural differences require introducing support for arm64
> platforms, after which a more generic naming convention is suggested.
> The in code comments are amended to provide a more platform independent
> explanation of the working of the code and nr_hugepages are configured
> as required. Finally, the file running the testcase is modified in order
> to prevent skipping of hugetlb testcases of va_high_addr_switch.
> 
> This series has been tested on 6.3.0-rc3 kernel, both on arm64 and x86
> platforms.

Would it make sense to get this series into the ARM tree, so it sees
more testing on ARM?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] selftests/mm: Implement support for arm64 on va
  2023-03-23 21:49 ` Andrew Morton
@ 2023-03-24 10:15   ` Anshuman Khandual
  0 siblings, 0 replies; 11+ messages in thread
From: Anshuman Khandual @ 2023-03-24 10:15 UTC (permalink / raw)
  To: Andrew Morton, Chaitanya S Prakash
  Cc: linux-mm, linux-kernel, Aneesh Kumar K . V, Kirill A . Shutemov,
	Shuah Khan, linux-kselftest



On 3/24/23 03:19, Andrew Morton wrote:
> On Thu, 23 Mar 2023 16:22:38 +0530 Chaitanya S Prakash <chaitanyas.prakash@arm.com> wrote:
> 
>> The va_128TBswitch selftest is designed and implemented for PowerPC and
>> x86 architectures which support a 128TB switch, up to 256TB of virtual
>> address space and hugepage sizes of 16MB and 2MB respectively. Arm64
>> platforms on the other hand support a 256Tb switch, up to 4PB of virtual
>> address space and a default hugepage size of 512MB when 64k pagesize is
>> enabled.
>>
>> These architectural differences require introducing support for arm64
>> platforms, after which a more generic naming convention is suggested.
>> The in code comments are amended to provide a more platform independent
>> explanation of the working of the code and nr_hugepages are configured
>> as required. Finally, the file running the testcase is modified in order
>> to prevent skipping of hugetlb testcases of va_high_addr_switch.
>>
>> This series has been tested on 6.3.0-rc3 kernel, both on arm64 and x86
>> platforms.
> 
> Would it make sense to get this series into the ARM tree, so it sees
> more testing on ARM
Rather, it will be better for this series to go via the mm tree instead
(via linux-next first) for better coverage on all platforms, this being
a common test.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] selftests/mm: Implement support for arm64 on va
  2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
                   ` (6 preceding siblings ...)
  2023-03-23 21:49 ` Andrew Morton
@ 2023-04-05  4:22 ` Chaitanya S Prakash
  7 siblings, 0 replies; 11+ messages in thread
From: Chaitanya S Prakash @ 2023-04-05  4:22 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Andrew Morton, Aneesh Kumar K . V, Kirill A . Shutemov,
	Shuah Khan, linux-kselftest



On 3/23/23 16:22, Chaitanya S Prakash wrote:
> The va_128TBswitch selftest is designed and implemented for PowerPC and
> x86 architectures which support a 128TB switch, up to 256TB of virtual
> address space and hugepage sizes of 16MB and 2MB respectively. Arm64
> platforms on the other hand support a 256Tb switch, up to 4PB of virtual
> address space and a default hugepage size of 512MB when 64k pagesize is
> enabled.
> 
> These architectural differences require introducing support for arm64
> platforms, after which a more generic naming convention is suggested.
> The in code comments are amended to provide a more platform independent
> explanation of the working of the code and nr_hugepages are configured
> as required. Finally, the file running the testcase is modified in order
> to prevent skipping of hugetlb testcases of va_high_addr_switch.
> 
> This series has been tested on 6.3.0-rc3 kernel, both on arm64 and x86
> platforms.

Gentle ping, any updates?
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kselftest@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> 
> Chaitanya S Prakash (5):
>    selftests/mm: Add support for arm64 platform on va switch
>    selftests/mm: Rename va_128TBswitch to va_high_addr_switch
>    selftests/mm: Add platform independent in code comments
>    selftests/mm: Configure nr_hugepages for arm64
>    selftests/mm: Run hugetlb testcases of va switch
> 
>   tools/testing/selftests/mm/Makefile           |  4 +-
>   tools/testing/selftests/mm/run_vmtests.sh     | 12 +++++-
>   ...va_128TBswitch.c => va_high_addr_switch.c} | 41 +++++++++++++++----
>   ..._128TBswitch.sh => va_high_addr_switch.sh} |  6 ++-
>   4 files changed, 49 insertions(+), 14 deletions(-)
>   rename tools/testing/selftests/mm/{va_128TBswitch.c => va_high_addr_switch.c} (86%)
>   rename tools/testing/selftests/mm/{va_128TBswitch.sh => va_high_addr_switch.sh} (89%)
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-05  4:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 10:52 [PATCH 0/5] selftests/mm: Implement support for arm64 on va Chaitanya S Prakash
2023-03-23 10:52 ` [PATCH 1/5] selftests/mm: Add support for arm64 platform on va switch Chaitanya S Prakash
2023-03-23 10:52 ` [PATCH 2/5] selftests/mm: Rename va_128TBswitch to va_high_addr_switch Chaitanya S Prakash
2023-03-23 10:52 ` [PATCH 3/5] selftests/mm: Add platform independent in code comments Chaitanya S Prakash
2023-03-23 10:52 ` [PATCH 4/5] selftests/mm: Configure nr_hugepages for arm64 Chaitanya S Prakash
2023-03-23 10:52 ` [PATCH 5/5] selftests/mm: Run hugetlb testcases of va switch Chaitanya S Prakash
2023-03-23 11:14 ` [PATCH 0/5] selftests/mm: Implement support for arm64 on va Kirill A. Shutemov
2023-03-23 11:59   ` Mark Rutland
2023-03-23 21:49 ` Andrew Morton
2023-03-24 10:15   ` Anshuman Khandual
2023-04-05  4:22 ` Chaitanya S Prakash

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.