* [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value
@ 2025-12-21 4:00 Chunyu Hu
2025-12-21 4:00 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Chunyu Hu
2025-12-21 18:57 ` [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Andrew Morton
0 siblings, 2 replies; 15+ messages in thread
From: Chunyu Hu @ 2025-12-21 4:00 UTC (permalink / raw)
To: akpm, david, shuah, linux-mm
Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett,
vbabka, rppt, surenb, mhocko, chuhu, Luiz Capitulino
Patch series "Fix va_high_addr_switch.sh test failure - again", v2.
The series address several issues exist for the va_high_addr_switch test:
1) the test return value is ignored in va_high_addr_switch.sh.
2) the va_high_addr_switch test requires 6 hugepages not 5.
3) the reurn value of the first test in va_high_addr_switch.c can be
overridden by the second test.
4) the nr_hugepages setup in run_vmtests.sh for arm64 can be done in
va_high_addr_switch.sh too.
5) update a comment for check_test_requirements.
Changes in v2:
- shorten the comment in for hugepages setup in v1
- add a new patch to fix the return value overridden issue in
va_high_addr_switch.c
- fix a code comment for check_test_requirements.
- update the series summary in patch 1
- add reviewed-by from Luiz Capitulino on patch 1 and patch 3
This patch: (of 5)
The return value should be return value of va_high_addr_switch, otherwise
a test failure would be silently ignored.
Reviewed-by: Luiz Capitulino <luizcap@redhat.com>
Fixes: d9d957bd7b61 ("selftests/mm: alloc hugepages in va_high_addr_switch test")
CC: Luiz Capitulino <luizcap@redhat.com>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
---
Chunyu Hu (5):
selftests/mm: fix va_high_addr_switch.sh return value
selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh
selftests/mm: remove arm64 nr_hugepages setup for va_high_addr_switch
test
selftests/mm: va_high_addr_switch return fail when either test failed
selftests/mm: fix comment for check_test_requirements
tools/testing/selftests/mm/run_vmtests.sh | 8 --------
tools/testing/selftests/mm/va_high_addr_switch.c | 10 +++++++---
tools/testing/selftests/mm/va_high_addr_switch.sh | 12 +++++++-----
3 files changed, 14 insertions(+), 16 deletions(-)
According to the doc below, I don't add the cover letter, not sure if cover
letter is preferred, and if that's the case, the doc need an update.
https://www.ozlabs.org/~akpm/stuff/tpp.txt
---
tools/testing/selftests/mm/va_high_addr_switch.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/mm/va_high_addr_switch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh
index a7d4b02b21dd..f89fe078a8e6 100755
--- a/tools/testing/selftests/mm/va_high_addr_switch.sh
+++ b/tools/testing/selftests/mm/va_high_addr_switch.sh
@@ -114,4 +114,6 @@ save_nr_hugepages
# 4 keep_mapped pages, and one for tmp usage
setup_nr_hugepages 5
./va_high_addr_switch --run-hugetlb
+retcode=$?
restore_nr_hugepages
+exit $retcode
--
2.49.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh 2025-12-21 4:00 [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Chunyu Hu @ 2025-12-21 4:00 ` Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 3/5] selftests/mm: remove arm64 nr_hugepages setup for va_high_addr_switch test Chunyu Hu 2025-12-22 19:34 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Luiz Capitulino 2025-12-21 18:57 ` [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Andrew Morton 1 sibling, 2 replies; 15+ messages in thread From: Chunyu Hu @ 2025-12-21 4:00 UTC (permalink / raw) To: akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, chuhu, Luiz Capitulino The va_high_addr_switch test requires 6 hugepages, not 5. If running the test directly by: ./va_high_addr_switch.sh, the test will hit a mmap 'FAIL' caused by not enough hugepages: ``` mmap(addr_switch_hint - hugepagesize, 2*hugepagesize, MAP_HUGETLB): 0x7f330f800000 - OK mmap(addr_switch_hint , 2*hugepagesize, MAP_FIXED | MAP_HUGETLB): 0xffffffffffffffff - FAILED ``` The failure can't be hit if run the tests by running 'run_vmtests.sh -t hugevm' because the nr_hugepages is set to 128 at the beginning of run_vmtests.sh and va_high_addr_switch.sh skip the setup of nr_hugepages because already enough. CC: Luiz Capitulino <luizcap@redhat.com> Fixes: d9d957bd7b61 ("selftests/mm: alloc hugepages in va_high_addr_switch test") Signed-off-by: Chunyu Hu <chuhu@redhat.com> --- tools/testing/selftests/mm/va_high_addr_switch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/va_high_addr_switch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh index f89fe078a8e6..a0c93d348b11 100755 --- a/tools/testing/selftests/mm/va_high_addr_switch.sh +++ b/tools/testing/selftests/mm/va_high_addr_switch.sh @@ -111,8 +111,8 @@ setup_nr_hugepages() check_test_requirements save_nr_hugepages -# 4 keep_mapped pages, and one for tmp usage -setup_nr_hugepages 5 +# The HugeTLB tests require 6 pages +setup_nr_hugepages 6 ./va_high_addr_switch --run-hugetlb retcode=$? restore_nr_hugepages -- 2.49.0 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 3/5] selftests/mm: remove arm64 nr_hugepages setup for va_high_addr_switch test 2025-12-21 4:00 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Chunyu Hu @ 2025-12-21 4:00 ` Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Chunyu Hu 2025-12-22 19:34 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Luiz Capitulino 1 sibling, 1 reply; 15+ messages in thread From: Chunyu Hu @ 2025-12-21 4:00 UTC (permalink / raw) To: akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, chuhu, Luiz Capitulino arm64 and x86_64 has the same nr_hugepages requriement for running the va_high_addr_switch test. Since commit d9d957bd7b61 ("selftests/mm: alloc hugepages in va_high_addr_switch test"), the setup can be done in va_high_addr_switch.sh. So remove the duplicated setup. Reviewed-by: Luiz Capitulino <luizcap@redhat.com> CC: Luiz Capitulino <luizcap@redhat.com> Signed-off-by: Chunyu Hu <chuhu@redhat.com> --- tools/testing/selftests/mm/run_vmtests.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index d9173f2312b7..2dadbfc6e535 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -412,15 +412,7 @@ if [ $VADDR64 -ne 0 ]; then fi # 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 bash ./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.49.0 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed 2025-12-21 4:00 ` [PATCH v2 3/5] selftests/mm: remove arm64 nr_hugepages setup for va_high_addr_switch test Chunyu Hu @ 2025-12-21 4:00 ` Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 5/5] selftests/mm: fix comment for check_test_requirements Chunyu Hu 2025-12-22 19:36 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Luiz Capitulino 0 siblings, 2 replies; 15+ messages in thread From: Chunyu Hu @ 2025-12-21 4:00 UTC (permalink / raw) To: akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, chuhu, Luiz Capitulino When the first test failed, and the hugetlb test passed, the result would be pass, but we expect a fail. Fix this issue by returning fail if either is not KSFT_PASS. CC: Luiz Capitulino <luizcap@redhat.com> Signed-off-by: Chunyu Hu <chuhu@redhat.com> --- tools/testing/selftests/mm/va_high_addr_switch.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/va_high_addr_switch.c b/tools/testing/selftests/mm/va_high_addr_switch.c index 02f290a69132..51401e081b20 100644 --- a/tools/testing/selftests/mm/va_high_addr_switch.c +++ b/tools/testing/selftests/mm/va_high_addr_switch.c @@ -322,7 +322,7 @@ static int supported_arch(void) int main(int argc, char **argv) { - int ret; + int ret, hugetlb_ret = KSFT_PASS; if (!supported_arch()) return KSFT_SKIP; @@ -331,6 +331,10 @@ int main(int argc, char **argv) ret = run_test(testcases, sz_testcases); if (argc == 2 && !strcmp(argv[1], "--run-hugetlb")) - ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); - return ret; + hugetlb_ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); + + if (ret == KSFT_PASS && hugetlb_ret == KSFT_PASS) + return KSFT_PASS; + else + return KSFT_FAIL; } -- 2.49.0 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 5/5] selftests/mm: fix comment for check_test_requirements 2025-12-21 4:00 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Chunyu Hu @ 2025-12-21 4:00 ` Chunyu Hu 2025-12-22 19:37 ` Luiz Capitulino 2025-12-22 19:36 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Luiz Capitulino 1 sibling, 1 reply; 15+ messages in thread From: Chunyu Hu @ 2025-12-21 4:00 UTC (permalink / raw) To: akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, chuhu, Luiz Capitulino The test supports arm64 as well so the comment is incorrect. And there's a check for arm64 in va_high_addr_switch.c. CC: Luiz Capitulino <luizcap@redhat.com> Fixes: 983e760bcdb6 ("selftest/mm: va_high_addr_switch: add ppc64 support check") Fixes: f556acc2facd ("selftests/mm: skip test for non-LPA2 and non-LVA systems") Signed-off-by: Chunyu Hu <chuhu@redhat.com> --- tools/testing/selftests/mm/va_high_addr_switch.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/va_high_addr_switch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh index a0c93d348b11..9492c2d72634 100755 --- a/tools/testing/selftests/mm/va_high_addr_switch.sh +++ b/tools/testing/selftests/mm/va_high_addr_switch.sh @@ -61,9 +61,9 @@ check_supported_ppc64() check_test_requirements() { - # The test supports x86_64 and powerpc64. We currently have no useful - # eligibility check for powerpc64, and the test itself will reject other - # architectures. + # The test supports x86_64, powerpc64 and arm64. There's check for arm64 + # in va_high_addr_switch.c. The test itself will reject other architectures. + case `uname -m` in "x86_64") check_supported_x86_64 -- 2.49.0 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 5/5] selftests/mm: fix comment for check_test_requirements 2025-12-21 4:00 ` [PATCH v2 5/5] selftests/mm: fix comment for check_test_requirements Chunyu Hu @ 2025-12-22 19:37 ` Luiz Capitulino 0 siblings, 0 replies; 15+ messages in thread From: Luiz Capitulino @ 2025-12-22 19:37 UTC (permalink / raw) To: Chunyu Hu, akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko On 2025-12-20 23:00, Chunyu Hu wrote: > The test supports arm64 as well so the comment is incorrect. And there's > a check for arm64 in va_high_addr_switch.c. > > CC: Luiz Capitulino <luizcap@redhat.com> > Fixes: 983e760bcdb6 ("selftest/mm: va_high_addr_switch: add ppc64 support check") > Fixes: f556acc2facd ("selftests/mm: skip test for non-LPA2 and non-LVA systems") > Signed-off-by: Chunyu Hu <chuhu@redhat.com> Reviewed-by: Luiz Capitulino <luizcap@redhat.com> > --- > tools/testing/selftests/mm/va_high_addr_switch.sh | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/mm/va_high_addr_switch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh > index a0c93d348b11..9492c2d72634 100755 > --- a/tools/testing/selftests/mm/va_high_addr_switch.sh > +++ b/tools/testing/selftests/mm/va_high_addr_switch.sh > @@ -61,9 +61,9 @@ check_supported_ppc64() > > check_test_requirements() > { > - # The test supports x86_64 and powerpc64. We currently have no useful > - # eligibility check for powerpc64, and the test itself will reject other > - # architectures. > + # The test supports x86_64, powerpc64 and arm64. There's check for arm64 > + # in va_high_addr_switch.c. The test itself will reject other architectures. > + > case `uname -m` in > "x86_64") > check_supported_x86_64 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed 2025-12-21 4:00 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 5/5] selftests/mm: fix comment for check_test_requirements Chunyu Hu @ 2025-12-22 19:36 ` Luiz Capitulino 2025-12-23 2:46 ` Chunyu Hu 1 sibling, 1 reply; 15+ messages in thread From: Luiz Capitulino @ 2025-12-22 19:36 UTC (permalink / raw) To: Chunyu Hu, akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko On 2025-12-20 23:00, Chunyu Hu wrote: > When the first test failed, and the hugetlb test passed, the result would > be pass, but we expect a fail. Fix this issue by returning fail if either > is not KSFT_PASS. > > CC: Luiz Capitulino <luizcap@redhat.com> > Signed-off-by: Chunyu Hu <chuhu@redhat.com> > --- > tools/testing/selftests/mm/va_high_addr_switch.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/mm/va_high_addr_switch.c b/tools/testing/selftests/mm/va_high_addr_switch.c > index 02f290a69132..51401e081b20 100644 > --- a/tools/testing/selftests/mm/va_high_addr_switch.c > +++ b/tools/testing/selftests/mm/va_high_addr_switch.c > @@ -322,7 +322,7 @@ static int supported_arch(void) > > int main(int argc, char **argv) > { > - int ret; > + int ret, hugetlb_ret = KSFT_PASS; > > if (!supported_arch()) > return KSFT_SKIP; > @@ -331,6 +331,10 @@ int main(int argc, char **argv) > > ret = run_test(testcases, sz_testcases); > if (argc == 2 && !strcmp(argv[1], "--run-hugetlb")) > - ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); Maybe you could just have used: ret |= run_test(hugetlb_testcases, sz_hugetlb_testcases); But anyways, as this is just testing code: Reviewed-by: Luiz Capitulino <luizcap@redhat.com> > - return ret; > + hugetlb_ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); > + > + if (ret == KSFT_PASS && hugetlb_ret == KSFT_PASS) > + return KSFT_PASS; > + else > + return KSFT_FAIL; > } ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed 2025-12-22 19:36 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Luiz Capitulino @ 2025-12-23 2:46 ` Chunyu Hu 2025-12-23 2:56 ` Andrew Morton 0 siblings, 1 reply; 15+ messages in thread From: Chunyu Hu @ 2025-12-23 2:46 UTC (permalink / raw) To: Luiz Capitulino, akpm Cc: akpm, david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko On Mon, Dec 22, 2025 at 02:36:18PM -0500, Luiz Capitulino wrote: > On 2025-12-20 23:00, Chunyu Hu wrote: > > When the first test failed, and the hugetlb test passed, the result would > > be pass, but we expect a fail. Fix this issue by returning fail if either > > is not KSFT_PASS. > > > > CC: Luiz Capitulino <luizcap@redhat.com> > > Signed-off-by: Chunyu Hu <chuhu@redhat.com> > > --- > > tools/testing/selftests/mm/va_high_addr_switch.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/tools/testing/selftests/mm/va_high_addr_switch.c b/tools/testing/selftests/mm/va_high_addr_switch.c > > index 02f290a69132..51401e081b20 100644 > > --- a/tools/testing/selftests/mm/va_high_addr_switch.c > > +++ b/tools/testing/selftests/mm/va_high_addr_switch.c > > @@ -322,7 +322,7 @@ static int supported_arch(void) > > int main(int argc, char **argv) > > { > > - int ret; > > + int ret, hugetlb_ret = KSFT_PASS; > > if (!supported_arch()) > > return KSFT_SKIP; > > @@ -331,6 +331,10 @@ int main(int argc, char **argv) > > ret = run_test(testcases, sz_testcases); > > if (argc == 2 && !strcmp(argv[1], "--run-hugetlb")) > > - ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); > > Maybe you could just have used: > > ret |= run_test(hugetlb_testcases, sz_hugetlb_testcases); Good point. I thought the result code is not encoded by bit, but for KSFT_PASS and KSFT_FAIL, and KSFT_SKIP, they are per bit. 85 #define KSFT_PASS 0 86 #define KSFT_FAIL 1 87 #define KSFT_XFAIL 2 88 #define KSFT_XPASS 3 89 #define KSFT_SKIP 4 @Andrew, do you think I need to send a v3 for using the simpified way? if so, send the whole series or the single patch? > > But anyways, as this is just testing code: > > Reviewed-by: Luiz Capitulino <luizcap@redhat.com> > > > - return ret; > > + hugetlb_ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); > > + > > + if (ret == KSFT_PASS && hugetlb_ret == KSFT_PASS) > > + return KSFT_PASS; > > + else > > + return KSFT_FAIL; > > } > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed 2025-12-23 2:46 ` Chunyu Hu @ 2025-12-23 2:56 ` Andrew Morton 2025-12-23 3:04 ` Chunyu Hu 0 siblings, 1 reply; 15+ messages in thread From: Andrew Morton @ 2025-12-23 2:56 UTC (permalink / raw) To: Chunyu Hu Cc: Luiz Capitulino, david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko On Tue, 23 Dec 2025 10:46:18 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > > > int main(int argc, char **argv) > > > { > > > - int ret; > > > + int ret, hugetlb_ret = KSFT_PASS; > > > if (!supported_arch()) > > > return KSFT_SKIP; > > > @@ -331,6 +331,10 @@ int main(int argc, char **argv) > > > ret = run_test(testcases, sz_testcases); > > > if (argc == 2 && !strcmp(argv[1], "--run-hugetlb")) > > > - ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); > > > > Maybe you could just have used: > > > > ret |= run_test(hugetlb_testcases, sz_hugetlb_testcases); > > Good point. I thought the result code is not encoded by bit, but for > KSFT_PASS and KSFT_FAIL, and KSFT_SKIP, they are per bit. > > 85 #define KSFT_PASS 0 > 86 #define KSFT_FAIL 1 > 87 #define KSFT_XFAIL 2 > 88 #define KSFT_XPASS 3 > 89 #define KSFT_SKIP 4 > > @Andrew, do you think I need to send a v3 for using the simpified way? > if so, send the whole series or the single patch? Leave it as it is? This thing isn't a bitfield, so using |= happens to work thanks to good luck. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed 2025-12-23 2:56 ` Andrew Morton @ 2025-12-23 3:04 ` Chunyu Hu 0 siblings, 0 replies; 15+ messages in thread From: Chunyu Hu @ 2025-12-23 3:04 UTC (permalink / raw) To: Andrew Morton Cc: Luiz Capitulino, david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko On Mon, Dec 22, 2025 at 06:56:18PM -0800, Andrew Morton wrote: > On Tue, 23 Dec 2025 10:46:18 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > > > > > int main(int argc, char **argv) > > > > { > > > > - int ret; > > > > + int ret, hugetlb_ret = KSFT_PASS; > > > > if (!supported_arch()) > > > > return KSFT_SKIP; > > > > @@ -331,6 +331,10 @@ int main(int argc, char **argv) > > > > ret = run_test(testcases, sz_testcases); > > > > if (argc == 2 && !strcmp(argv[1], "--run-hugetlb")) > > > > - ret = run_test(hugetlb_testcases, sz_hugetlb_testcases); > > > > > > Maybe you could just have used: > > > > > > ret |= run_test(hugetlb_testcases, sz_hugetlb_testcases); > > > > Good point. I thought the result code is not encoded by bit, but for > > KSFT_PASS and KSFT_FAIL, and KSFT_SKIP, they are per bit. > > > > 85 #define KSFT_PASS 0 > > 86 #define KSFT_FAIL 1 > > 87 #define KSFT_XFAIL 2 > > 88 #define KSFT_XPASS 3 > > 89 #define KSFT_SKIP 4 > > > > @Andrew, do you think I need to send a v3 for using the simpified way? > > if so, send the whole series or the single patch? > > Leave it as it is? This thing isn't a bitfield, so using |= happens to > work thanks to good luck. It works for me. Thanks. > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh 2025-12-21 4:00 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 3/5] selftests/mm: remove arm64 nr_hugepages setup for va_high_addr_switch test Chunyu Hu @ 2025-12-22 19:34 ` Luiz Capitulino 1 sibling, 0 replies; 15+ messages in thread From: Luiz Capitulino @ 2025-12-22 19:34 UTC (permalink / raw) To: Chunyu Hu, akpm, david, shuah, linux-mm Cc: linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko On 2025-12-20 23:00, Chunyu Hu wrote: > The va_high_addr_switch test requires 6 hugepages, not 5. If running the > test directly by: ./va_high_addr_switch.sh, the test will hit a mmap 'FAIL' > caused by not enough hugepages: > ``` > mmap(addr_switch_hint - hugepagesize, 2*hugepagesize, MAP_HUGETLB): 0x7f330f800000 - OK > mmap(addr_switch_hint , 2*hugepagesize, MAP_FIXED | MAP_HUGETLB): 0xffffffffffffffff - FAILED > ``` > The failure can't be hit if run the tests by running 'run_vmtests.sh -t > hugevm' because the nr_hugepages is set to 128 at the beginning of > run_vmtests.sh and va_high_addr_switch.sh skip the setup of nr_hugepages > because already enough. Reviewed-by: Luiz Capitulino <luizcap@redhat.com> > > CC: Luiz Capitulino <luizcap@redhat.com> > Fixes: d9d957bd7b61 ("selftests/mm: alloc hugepages in va_high_addr_switch test") > Signed-off-by: Chunyu Hu <chuhu@redhat.com> > --- > tools/testing/selftests/mm/va_high_addr_switch.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/mm/va_high_addr_switch.sh b/tools/testing/selftests/mm/va_high_addr_switch.sh > index f89fe078a8e6..a0c93d348b11 100755 > --- a/tools/testing/selftests/mm/va_high_addr_switch.sh > +++ b/tools/testing/selftests/mm/va_high_addr_switch.sh > @@ -111,8 +111,8 @@ setup_nr_hugepages() > > check_test_requirements > save_nr_hugepages > -# 4 keep_mapped pages, and one for tmp usage > -setup_nr_hugepages 5 > +# The HugeTLB tests require 6 pages > +setup_nr_hugepages 6 > ./va_high_addr_switch --run-hugetlb > retcode=$? > restore_nr_hugepages ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value 2025-12-21 4:00 [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Chunyu Hu @ 2025-12-21 18:57 ` Andrew Morton 2025-12-22 4:32 ` Chunyu Hu 1 sibling, 1 reply; 15+ messages in thread From: Andrew Morton @ 2025-12-21 18:57 UTC (permalink / raw) To: Chunyu Hu Cc: david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, Luiz Capitulino On Sun, 21 Dec 2025 12:00:21 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > Patch series "Fix va_high_addr_switch.sh test failure - again", v2. > > The series address several issues exist for the va_high_addr_switch test: > 1) the test return value is ignored in va_high_addr_switch.sh. > 2) the va_high_addr_switch test requires 6 hugepages not 5. > 3) the reurn value of the first test in va_high_addr_switch.c can be > overridden by the second test. > 4) the nr_hugepages setup in run_vmtests.sh for arm64 can be done in > va_high_addr_switch.sh too. > 5) update a comment for check_test_requirements. > > Changes in v2: > - shorten the comment in for hugepages setup in v1 > - add a new patch to fix the return value overridden issue in > va_high_addr_switch.c > - fix a code comment for check_test_requirements. > - update the series summary in patch 1 > - add reviewed-by from Luiz Capitulino on patch 1 and patch 3 The "Changes in v2" material is best placed below the "---" separator - I prefer not to capture such short-term development-time info within the permanent kernel record. > This patch: (of 5) > > The return value should be return value of va_high_addr_switch, otherwise > a test failure would be silently ignored. > > Reviewed-by: Luiz Capitulino <luizcap@redhat.com> > Fixes: d9d957bd7b61 ("selftests/mm: alloc hugepages in va_high_addr_switch test") > CC: Luiz Capitulino <luizcap@redhat.com> > Signed-off-by: Chunyu Hu <chuhu@redhat.com> > > ... > > According to the doc below, I don't add the cover letter, not sure if cover > letter is preferred, and if that's the case, the doc need an update. Funnily enough, your series was in the exact format which I use when committing patch series. Usually people put the cover letter in a separate [0/N] email and I move that into the [1/N] patch's changelog, as you've done here. > https://www.ozlabs.org/~akpm/stuff/tpp.txt God does that still exist? Pretty soon it will be able to legally drink in bars. I think its content got absorbed into a Documentation/ file a long time ago! ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value 2025-12-21 18:57 ` [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Andrew Morton @ 2025-12-22 4:32 ` Chunyu Hu 2025-12-23 1:15 ` SeongJae Park 0 siblings, 1 reply; 15+ messages in thread From: Chunyu Hu @ 2025-12-22 4:32 UTC (permalink / raw) To: Andrew Morton Cc: david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, Luiz Capitulino On Sun, Dec 21, 2025 at 10:57:09AM -0800, Andrew Morton wrote: > On Sun, 21 Dec 2025 12:00:21 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > > > Patch series "Fix va_high_addr_switch.sh test failure - again", v2. > > > > The series address several issues exist for the va_high_addr_switch test: > > 1) the test return value is ignored in va_high_addr_switch.sh. > > 2) the va_high_addr_switch test requires 6 hugepages not 5. > > 3) the reurn value of the first test in va_high_addr_switch.c can be > > overridden by the second test. > > 4) the nr_hugepages setup in run_vmtests.sh for arm64 can be done in > > va_high_addr_switch.sh too. > > 5) update a comment for check_test_requirements. > > > > Changes in v2: > > - shorten the comment in for hugepages setup in v1 > > - add a new patch to fix the return value overridden issue in > > va_high_addr_switch.c > > - fix a code comment for check_test_requirements. > > - update the series summary in patch 1 > > - add reviewed-by from Luiz Capitulino on patch 1 and patch 3 > > The "Changes in v2" material is best placed below the "---" separator - > I prefer not to capture such short-term development-time info within > the permanent kernel record. That makes sense. > > > This patch: (of 5) > > > > The return value should be return value of va_high_addr_switch, otherwise > > a test failure would be silently ignored. > > > > Reviewed-by: Luiz Capitulino <luizcap@redhat.com> > > Fixes: d9d957bd7b61 ("selftests/mm: alloc hugepages in va_high_addr_switch test") > > CC: Luiz Capitulino <luizcap@redhat.com> > > Signed-off-by: Chunyu Hu <chuhu@redhat.com> > > > > ... > > > > According to the doc below, I don't add the cover letter, not sure if cover > > letter is preferred, and if that's the case, the doc need an update. > > Funnily enough, your series was in the exact format which I use when > committing patch series. Usually people put the cover letter in a > separate [0/N] email and I move that into the [1/N] patch's changelog, > as you've done here. yes, I see cover-letter is the actualy way people is using and looks like I did some of your work putting that cover letter into the first patch. I think I'll add cover-letter in the future. > > > https://www.ozlabs.org/~akpm/stuff/tpp.txt > > God does that still exist? Pretty soon it will be able to legally > drink in bars. > > I think its content got absorbed into a Documentation/ file a long time > ago! I happened to open it before I submitting my patch, and wanted to know what would happen if I follow that. And it looks like cover letter has become the actual convention. > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value 2025-12-22 4:32 ` Chunyu Hu @ 2025-12-23 1:15 ` SeongJae Park 2025-12-23 2:54 ` Chunyu Hu 0 siblings, 1 reply; 15+ messages in thread From: SeongJae Park @ 2025-12-23 1:15 UTC (permalink / raw) To: Chunyu Hu Cc: SeongJae Park, Andrew Morton, david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, Luiz Capitulino On Mon, 22 Dec 2025 12:32:16 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > On Sun, Dec 21, 2025 at 10:57:09AM -0800, Andrew Morton wrote: > > On Sun, 21 Dec 2025 12:00:21 +0800 Chunyu Hu <chuhu@redhat.com> wrote: [...] > > > According to the doc below, I don't add the cover letter, not sure if cover > > > letter is preferred, and if that's the case, the doc need an update. > > > > Funnily enough, your series was in the exact format which I use when > > committing patch series. Usually people put the cover letter in a > > separate [0/N] email and I move that into the [1/N] patch's changelog, > > as you've done here. > > yes, I see cover-letter is the actualy way people is using and looks > like I did some of your work putting that cover letter into the first > patch. I think I'll add cover-letter in the future. > > > > > > > https://www.ozlabs.org/~akpm/stuff/tpp.txt > > > > God does that still exist? Pretty soon it will be able to legally > > drink in bars. > > > > I think its content got absorbed into a Documentation/ file a long time > > ago! > > I happened to open it before I submitting my patch, and wanted to know > what would happen if I follow that. And it looks like cover letter has > become the actual convention. I think you could use Documentation/process/submitting-patches.rst instead. The html version is also available at https://origin.kernel.org/doc/html/latest/process/submitting-patches.html Thanks, SJ [...] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value 2025-12-23 1:15 ` SeongJae Park @ 2025-12-23 2:54 ` Chunyu Hu 0 siblings, 0 replies; 15+ messages in thread From: Chunyu Hu @ 2025-12-23 2:54 UTC (permalink / raw) To: SeongJae Park Cc: Andrew Morton, david, shuah, linux-mm, linux-kselftest, linux-kernel, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko, Luiz Capitulino On Mon, Dec 22, 2025 at 05:15:31PM -0800, SeongJae Park wrote: > On Mon, 22 Dec 2025 12:32:16 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > > > On Sun, Dec 21, 2025 at 10:57:09AM -0800, Andrew Morton wrote: > > > On Sun, 21 Dec 2025 12:00:21 +0800 Chunyu Hu <chuhu@redhat.com> wrote: > [...] > > > > According to the doc below, I don't add the cover letter, not sure if cover > > > > letter is preferred, and if that's the case, the doc need an update. > > > > > > Funnily enough, your series was in the exact format which I use when > > > committing patch series. Usually people put the cover letter in a > > > separate [0/N] email and I move that into the [1/N] patch's changelog, > > > as you've done here. > > > > yes, I see cover-letter is the actualy way people is using and looks > > like I did some of your work putting that cover letter into the first > > patch. I think I'll add cover-letter in the future. > > > > > > > > > > > https://www.ozlabs.org/~akpm/stuff/tpp.txt > > > > > > God does that still exist? Pretty soon it will be able to legally > > > drink in bars. > > > > > > I think its content got absorbed into a Documentation/ file a long time > > > ago! > > > > I happened to open it before I submitting my patch, and wanted to know > > what would happen if I follow that. And it looks like cover letter has > > become the actual convention. > > I think you could use > Documentation/process/submitting-patches.rst instead. The html version is also > available at > https://origin.kernel.org/doc/html/latest/process/submitting-patches.html Thanks! Sure. I'll use that. I know this doc, it's where I find the tpp.txt in the 'References' section. > > > Thanks, > SJ > > [...] > ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-12-23 3:04 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-12-21 4:00 [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 3/5] selftests/mm: remove arm64 nr_hugepages setup for va_high_addr_switch test Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Chunyu Hu 2025-12-21 4:00 ` [PATCH v2 5/5] selftests/mm: fix comment for check_test_requirements Chunyu Hu 2025-12-22 19:37 ` Luiz Capitulino 2025-12-22 19:36 ` [PATCH v2 4/5] selftests/mm: va_high_addr_switch return fail when either test failed Luiz Capitulino 2025-12-23 2:46 ` Chunyu Hu 2025-12-23 2:56 ` Andrew Morton 2025-12-23 3:04 ` Chunyu Hu 2025-12-22 19:34 ` [PATCH v2 2/5] selftests/mm: allocate 6 hugepages in va_high_addr_switch.sh Luiz Capitulino 2025-12-21 18:57 ` [PATCH v2 1/5] selftests/mm: fix va_high_addr_switch.sh return value Andrew Morton 2025-12-22 4:32 ` Chunyu Hu 2025-12-23 1:15 ` SeongJae Park 2025-12-23 2:54 ` Chunyu Hu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox