* [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging
@ 2022-06-27 16:13 Adam Sindelar
2022-06-27 16:22 ` Adam Sindelar
2022-06-27 16:28 ` David Vernet
0 siblings, 2 replies; 5+ messages in thread
From: Adam Sindelar @ 2022-06-27 16:13 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Adam Sindelar, Adam Sindelar, David Vernet, kernel-team
The test va_128TBswitch.c expects to be able to pass mmap an address hint
and length that cross the address 1<<47. This is not possible without
5-level page tables, so the test fails.
The test is already only run on 64-bit powerpc and x86 archs, but this
patch adds an additional check that skips the test if PG_TABLE_LEVELS < 5.
There is precedent for checking /proc/config.gz in selftests, e.g. in
selftests/firmware.
Running `sudo make -C tools/testing/selftests TARGETS=vm run_tests`
produces the desired output:
```
---------------------------
running ./va_128TBswitch.sh
---------------------------
./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test
[SKIP]
-------------------------------
```
v2:
- Function variables declared local
- Fixed variable name typo in Makefile
- Comment to explain gzip -dcfq
Signed-off-by: Adam Sindelar <adam@wowsignal.io>
---
tools/testing/selftests/vm/Makefile | 1 +
tools/testing/selftests/vm/run_vmtests.sh | 2 +-
tools/testing/selftests/vm/va_128TBswitch.sh | 39 ++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index c45e535ff4b8..7860d0969888 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -91,6 +91,7 @@ endif
TEST_PROGS := run_vmtests.sh
TEST_FILES := test_vmalloc.sh
+TEST_FILES += va_128TBswitch.sh
KSFT_KHDR_INSTALL := 1
include ../lib.mk
diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh
index a2302b5faaf2..edda7350ccca 100755
--- a/tools/testing/selftests/vm/run_vmtests.sh
+++ b/tools/testing/selftests/vm/run_vmtests.sh
@@ -149,7 +149,7 @@ if [ $VADDR64 -ne 0 ]; then
run_test ./virtual_address_range
# virtual address 128TB switch test
- run_test ./va_128TBswitch
+ run_test ./va_128TBswitch.sh
fi # VADDR64
# vmalloc stability smoke test
diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh
new file mode 100755
index 000000000000..767a6465b5d2
--- /dev/null
+++ b/tools/testing/selftests/vm/va_128TBswitch.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2022 Adam Sindelar (Meta) <adam@wowsignal.io>
+#
+# This is a test for mmap behavior with 5-level paging. This script wraps the
+# real test to check that the kernel is configured to support at least 5
+# pagetable levels.
+
+# 1 means the test failed
+exitcode=1
+
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+die()
+{
+ echo "$1"
+ exit $exitcode
+}
+
+check_test_requirements()
+{
+ local config="/proc/config.gz"
+ [[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
+ [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot"
+
+ # gzip -dcfq automatically handles both compressed and plaintext input.
+ # See man 1 gzip under '-f'.
+ local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
+
+ if [[ "${pg_table_levels}" -lt 5 ]]; then
+ echo "$0: PG_TABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
+ exit $ksft_skip
+ fi
+}
+
+check_test_requirements
+./va_128TBswitch
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging
2022-06-27 16:13 [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging Adam Sindelar
@ 2022-06-27 16:22 ` Adam Sindelar
2022-06-27 16:28 ` David Vernet
1 sibling, 0 replies; 5+ messages in thread
From: Adam Sindelar @ 2022-06-27 16:22 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, Adam Sindelar, David Vernet, kernel-team
On Mon, Jun 27, 2022 at 06:13:32PM +0200, Adam Sindelar wrote:
> The test va_128TBswitch.c expects to be able to pass mmap an address hint
> and length that cross the address 1<<47. This is not possible without
> 5-level page tables, so the test fails.
>
> The test is already only run on 64-bit powerpc and x86 archs, but this
> patch adds an additional check that skips the test if PG_TABLE_LEVELS < 5.
> There is precedent for checking /proc/config.gz in selftests, e.g. in
> selftests/firmware.
>
> Running `sudo make -C tools/testing/selftests TARGETS=vm run_tests`
> produces the desired output:
>
> ```
> ---------------------------
> running ./va_128TBswitch.sh
> ---------------------------
> ./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test
> [SKIP]
> -------------------------------
> ```
>
> v2:
> - Function variables declared local
> - Fixed variable name typo in Makefile
> - Comment to explain gzip -dcfq
>
> Signed-off-by: Adam Sindelar <adam@wowsignal.io>
> ---
> tools/testing/selftests/vm/Makefile | 1 +
> tools/testing/selftests/vm/run_vmtests.sh | 2 +-
> tools/testing/selftests/vm/va_128TBswitch.sh | 39 ++++++++++++++++++++
> 3 files changed, 41 insertions(+), 1 deletion(-)
> create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh
>
> diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
> index c45e535ff4b8..7860d0969888 100644
> --- a/tools/testing/selftests/vm/Makefile
> +++ b/tools/testing/selftests/vm/Makefile
> @@ -91,6 +91,7 @@ endif
> TEST_PROGS := run_vmtests.sh
>
> TEST_FILES := test_vmalloc.sh
> +TEST_FILES += va_128TBswitch.sh
>
> KSFT_KHDR_INSTALL := 1
> include ../lib.mk
> diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh
> index a2302b5faaf2..edda7350ccca 100755
> --- a/tools/testing/selftests/vm/run_vmtests.sh
> +++ b/tools/testing/selftests/vm/run_vmtests.sh
> @@ -149,7 +149,7 @@ if [ $VADDR64 -ne 0 ]; then
> run_test ./virtual_address_range
>
> # virtual address 128TB switch test
> - run_test ./va_128TBswitch
> + run_test ./va_128TBswitch.sh
> fi # VADDR64
>
> # vmalloc stability smoke test
> diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh
> new file mode 100755
> index 000000000000..767a6465b5d2
> --- /dev/null
> +++ b/tools/testing/selftests/vm/va_128TBswitch.sh
> @@ -0,0 +1,39 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Copyright (C) 2022 Adam Sindelar (Meta) <adam@wowsignal.io>
> +#
> +# This is a test for mmap behavior with 5-level paging. This script wraps the
> +# real test to check that the kernel is configured to support at least 5
> +# pagetable levels.
> +
> +# 1 means the test failed
> +exitcode=1
> +
> +# Kselftest framework requirement - SKIP code is 4.
> +ksft_skip=4
> +
> +die()
> +{
> + echo "$1"
> + exit $exitcode
> +}
> +
> +check_test_requirements()
> +{
> + local config="/proc/config.gz"
> + [[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
> + [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot"
> +
> + # gzip -dcfq automatically handles both compressed and plaintext input.
> + # See man 1 gzip under '-f'.
> + local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
> +
> + if [[ "${pg_table_levels}" -lt 5 ]]; then
> + echo "$0: PG_TABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
> + exit $ksft_skip
> + fi
> +}
> +
> +check_test_requirements
> +./va_128TBswitch
> --
> 2.35.1
>
Apologies for sending the v2 out twice - I had the VM crash in the
middle of sending the first email.
-Adam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging
2022-06-27 16:13 [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging Adam Sindelar
2022-06-27 16:22 ` Adam Sindelar
@ 2022-06-27 16:28 ` David Vernet
2022-06-27 16:38 ` Adam Sindelar
1 sibling, 1 reply; 5+ messages in thread
From: David Vernet @ 2022-06-27 16:28 UTC (permalink / raw)
To: Adam Sindelar; +Cc: Andrew Morton, linux-mm, Adam Sindelar, kernel-team
On Mon, Jun 27, 2022 at 06:13:32PM +0200, Adam Sindelar wrote:
> The test va_128TBswitch.c expects to be able to pass mmap an address hint
> and length that cross the address 1<<47. This is not possible without
> 5-level page tables, so the test fails.
>
> The test is already only run on 64-bit powerpc and x86 archs, but this
> patch adds an additional check that skips the test if PG_TABLE_LEVELS < 5.
> There is precedent for checking /proc/config.gz in selftests, e.g. in
> selftests/firmware.
>
> Running `sudo make -C tools/testing/selftests TARGETS=vm run_tests`
> produces the desired output:
>
> ```
> ---------------------------
> running ./va_128TBswitch.sh
> ---------------------------
> ./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test
> [SKIP]
> -------------------------------
> ```
Different subsystems have different workflows, but I don't recall having
ever seen markdown used in any mm patches. Can you update the patch
description to not use markdown?
> v2:
> - Function variables declared local
> - Fixed variable name typo in Makefile
> - Comment to explain gzip -dcfq
Can you move the version-change descriptions out of the commit summary and
into the patch itself, directly after the ---? We don't want it to be
included in the changelog that eventually gets merged. This is described in
more detail in [0].
[0] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
> Signed-off-by: Adam Sindelar <adam@wowsignal.io>
> ---
> tools/testing/selftests/vm/Makefile | 1 +
> tools/testing/selftests/vm/run_vmtests.sh | 2 +-
> tools/testing/selftests/vm/va_128TBswitch.sh | 39 ++++++++++++++++++++
> 3 files changed, 41 insertions(+), 1 deletion(-)
> create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh
>
> diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
> index c45e535ff4b8..7860d0969888 100644
> --- a/tools/testing/selftests/vm/Makefile
> +++ b/tools/testing/selftests/vm/Makefile
> @@ -91,6 +91,7 @@ endif
> TEST_PROGS := run_vmtests.sh
>
> TEST_FILES := test_vmalloc.sh
> +TEST_FILES += va_128TBswitch.sh
>
> KSFT_KHDR_INSTALL := 1
> include ../lib.mk
> diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh
> index a2302b5faaf2..edda7350ccca 100755
> --- a/tools/testing/selftests/vm/run_vmtests.sh
> +++ b/tools/testing/selftests/vm/run_vmtests.sh
> @@ -149,7 +149,7 @@ if [ $VADDR64 -ne 0 ]; then
> run_test ./virtual_address_range
>
> # virtual address 128TB switch test
> - run_test ./va_128TBswitch
> + run_test ./va_128TBswitch.sh
> fi # VADDR64
>
> # vmalloc stability smoke test
> diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh
> new file mode 100755
> index 000000000000..767a6465b5d2
> --- /dev/null
> +++ b/tools/testing/selftests/vm/va_128TBswitch.sh
> @@ -0,0 +1,39 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Copyright (C) 2022 Adam Sindelar (Meta) <adam@wowsignal.io>
> +#
> +# This is a test for mmap behavior with 5-level paging. This script wraps the
> +# real test to check that the kernel is configured to support at least 5
> +# pagetable levels.
> +
> +# 1 means the test failed
> +exitcode=1
Agreed that it's preferable to follow the contours that already exist in
the vm/ tests, but IMO this is pretty confusing and should be fixed for the
whole suite in a follow-on patch. Both ksft_skip and exitcode are exit
codes so this variable name doesn't really make sense.
> +# Kselftest framework requirement - SKIP code is 4.
> +ksft_skip=4
> +
> +die()
Sorry, missed this on the first pass, but can we change the name of this
function to fail() to show that we're failing the test rather than killing
the testrun?
> +{
> + echo "$1"
> + exit $exitcode
> +}
> +
> +check_test_requirements()
> +{
> + local config="/proc/config.gz"
> + [[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
> + [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot"
> +
> + # gzip -dcfq automatically handles both compressed and plaintext input.
> + # See man 1 gzip under '-f'.
> + local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
> +
> + if [[ "${pg_table_levels}" -lt 5 ]]; then
> + echo "$0: PG_TABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
> + exit $ksft_skip
> + fi
> +}
> +
> +check_test_requirements
> +./va_128TBswitch
> --
> 2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging
2022-06-27 16:28 ` David Vernet
@ 2022-06-27 16:38 ` Adam Sindelar
0 siblings, 0 replies; 5+ messages in thread
From: Adam Sindelar @ 2022-06-27 16:38 UTC (permalink / raw)
To: David Vernet; +Cc: Andrew Morton, linux-mm, Adam Sindelar, kernel-team
On Mon, Jun 27, 2022 at 09:28:34AM -0700, David Vernet wrote:
> On Mon, Jun 27, 2022 at 06:13:32PM +0200, Adam Sindelar wrote:
> > The test va_128TBswitch.c expects to be able to pass mmap an address hint
> > and length that cross the address 1<<47. This is not possible without
> > 5-level page tables, so the test fails.
> >
> > The test is already only run on 64-bit powerpc and x86 archs, but this
> > patch adds an additional check that skips the test if PG_TABLE_LEVELS < 5.
> > There is precedent for checking /proc/config.gz in selftests, e.g. in
> > selftests/firmware.
> >
> > Running `sudo make -C tools/testing/selftests TARGETS=vm run_tests`
> > produces the desired output:
> >
> > ```
> > ---------------------------
> > running ./va_128TBswitch.sh
> > ---------------------------
> > ./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test
> > [SKIP]
> > -------------------------------
> > ```
>
> Different subsystems have different workflows, but I don't recall having
> ever seen markdown used in any mm patches. Can you update the patch
> description to not use markdown?
>
Ah, my bad - force of habit.
> > v2:
> > - Function variables declared local
> > - Fixed variable name typo in Makefile
> > - Comment to explain gzip -dcfq
>
> Can you move the version-change descriptions out of the commit summary and
> into the patch itself, directly after the ---? We don't want it to be
> included in the changelog that eventually gets merged. This is described in
> more detail in [0].
>
> [0] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
>
Fixed in v3. Thanks for the link!
> > Signed-off-by: Adam Sindelar <adam@wowsignal.io>
> > ---
> > tools/testing/selftests/vm/Makefile | 1 +
> > tools/testing/selftests/vm/run_vmtests.sh | 2 +-
> > tools/testing/selftests/vm/va_128TBswitch.sh | 39 ++++++++++++++++++++
> > 3 files changed, 41 insertions(+), 1 deletion(-)
> > create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh
> >
> > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
> > index c45e535ff4b8..7860d0969888 100644
> > --- a/tools/testing/selftests/vm/Makefile
> > +++ b/tools/testing/selftests/vm/Makefile
> > @@ -91,6 +91,7 @@ endif
> > TEST_PROGS := run_vmtests.sh
> >
> > TEST_FILES := test_vmalloc.sh
> > +TEST_FILES += va_128TBswitch.sh
> >
> > KSFT_KHDR_INSTALL := 1
> > include ../lib.mk
> > diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh
> > index a2302b5faaf2..edda7350ccca 100755
> > --- a/tools/testing/selftests/vm/run_vmtests.sh
> > +++ b/tools/testing/selftests/vm/run_vmtests.sh
> > @@ -149,7 +149,7 @@ if [ $VADDR64 -ne 0 ]; then
> > run_test ./virtual_address_range
> >
> > # virtual address 128TB switch test
> > - run_test ./va_128TBswitch
> > + run_test ./va_128TBswitch.sh
> > fi # VADDR64
> >
> > # vmalloc stability smoke test
> > diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh
> > new file mode 100755
> > index 000000000000..767a6465b5d2
> > --- /dev/null
> > +++ b/tools/testing/selftests/vm/va_128TBswitch.sh
> > @@ -0,0 +1,39 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +#
> > +# Copyright (C) 2022 Adam Sindelar (Meta) <adam@wowsignal.io>
> > +#
> > +# This is a test for mmap behavior with 5-level paging. This script wraps the
> > +# real test to check that the kernel is configured to support at least 5
> > +# pagetable levels.
> > +
> > +# 1 means the test failed
> > +exitcode=1
>
> Agreed that it's preferable to follow the contours that already exist in
> the vm/ tests, but IMO this is pretty confusing and should be fixed for the
> whole suite in a follow-on patch. Both ksft_skip and exitcode are exit
> codes so this variable name doesn't really make sense.
>
> > +# Kselftest framework requirement - SKIP code is 4.
> > +ksft_skip=4
> > +
> > +die()
>
> Sorry, missed this on the first pass, but can we change the name of this
> function to fail() to show that we're failing the test rather than killing
> the testrun?
>
> > +{
> > + echo "$1"
> > + exit $exitcode
> > +}
> > +
> > +check_test_requirements()
> > +{
> > + local config="/proc/config.gz"
> > + [[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
> > + [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot"
> > +
> > + # gzip -dcfq automatically handles both compressed and plaintext input.
> > + # See man 1 gzip under '-f'.
> > + local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
> > +
> > + if [[ "${pg_table_levels}" -lt 5 ]]; then
> > + echo "$0: PG_TABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
> > + exit $ksft_skip
> > + fi
> > +}
> > +
> > +check_test_requirements
> > +./va_128TBswitch
> > --
> > 2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging
@ 2022-06-27 16:07 Adam Sindelar
0 siblings, 0 replies; 5+ messages in thread
From: Adam Sindelar @ 2022-06-27 16:07 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Adam Sindelar, Adam Sindelar, David Vernet, kernel-team
The test va_128TBswitch.c expects to be able to pass mmap an address hint
and length that cross the address 1<<47. This is not possible without
5-level page tables, so the test fails.
The test is already only run on 64-bit powerpc and x86 archs, but this
patch adds an additional check that skips the test if PG_TABLE_LEVELS < 5.
There is precedent for checking /proc/config.gz in selftests, e.g. in
selftests/firmware.
Running `sudo make -C tools/testing/selftests TARGETS=vm run_tests`
produces the desired output:
```
---------------------------
running ./va_128TBswitch.sh
---------------------------
./va_128TBswitch.sh: PG_TABLE_LEVELS=4, must be >= 5 to run this test
[SKIP]
-------------------------------
```
v2:
- Function variables declared local
- Fixed variable name typo in Makefile
- Comment to explain gzip -dcfq
Signed-off-by: Adam Sindelar <adam@wowsignal.io>
---
tools/testing/selftests/vm/Makefile | 1 +
tools/testing/selftests/vm/run_vmtests.sh | 2 +-
tools/testing/selftests/vm/va_128TBswitch.sh | 39 ++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
create mode 100755 tools/testing/selftests/vm/va_128TBswitch.sh
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index c45e535ff4b8..7860d0969888 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -91,6 +91,7 @@ endif
TEST_PROGS := run_vmtests.sh
TEST_FILES := test_vmalloc.sh
+TEST_FILES += va_128TBswitch.sh
KSFT_KHDR_INSTALL := 1
include ../lib.mk
diff --git a/tools/testing/selftests/vm/run_vmtests.sh b/tools/testing/selftests/vm/run_vmtests.sh
index a2302b5faaf2..edda7350ccca 100755
--- a/tools/testing/selftests/vm/run_vmtests.sh
+++ b/tools/testing/selftests/vm/run_vmtests.sh
@@ -149,7 +149,7 @@ if [ $VADDR64 -ne 0 ]; then
run_test ./virtual_address_range
# virtual address 128TB switch test
- run_test ./va_128TBswitch
+ run_test ./va_128TBswitch.sh
fi # VADDR64
# vmalloc stability smoke test
diff --git a/tools/testing/selftests/vm/va_128TBswitch.sh b/tools/testing/selftests/vm/va_128TBswitch.sh
new file mode 100755
index 000000000000..767a6465b5d2
--- /dev/null
+++ b/tools/testing/selftests/vm/va_128TBswitch.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2022 Adam Sindelar (Meta) <adam@wowsignal.io>
+#
+# This is a test for mmap behavior with 5-level paging. This script wraps the
+# real test to check that the kernel is configured to support at least 5
+# pagetable levels.
+
+# 1 means the test failed
+exitcode=1
+
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+die()
+{
+ echo "$1"
+ exit $exitcode
+}
+
+check_test_requirements()
+{
+ local config="/proc/config.gz"
+ [[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
+ [[ -f "${config}" ]] || die "Cannot find kernel config in /proc or /boot"
+
+ # gzip -dcfq automatically handles both compressed and plaintext input.
+ # See man 1 gzip under '-f'.
+ local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
+
+ if [[ "${pg_table_levels}" -lt 5 ]]; then
+ echo "$0: PG_TABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
+ exit $ksft_skip
+ fi
+}
+
+check_test_requirements
+./va_128TBswitch
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-27 16:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 16:13 [PATCH v2] selftests/vm: Only run 128TBswitch with 5-level paging Adam Sindelar
2022-06-27 16:22 ` Adam Sindelar
2022-06-27 16:28 ` David Vernet
2022-06-27 16:38 ` Adam Sindelar
-- strict thread matches above, loose matches on Subject: below --
2022-06-27 16:07 Adam Sindelar
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.