* [PATCH] selftest: hugetlb_dio: Fix test naming
@ 2024-11-27 16:14 Mark Brown
2024-11-28 5:16 ` Donet Tom
2024-11-28 7:14 ` Muhammad Usama Anjum
0 siblings, 2 replies; 5+ messages in thread
From: Mark Brown @ 2024-11-27 16:14 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, Donet Tom
Cc: Ritesh Harjani (IBM),
Muhammad Usama Anjum, linux-mm, linux-kselftest, linux-kernel,
Mark Brown
The string logged when a test passes or fails is used by the selftest
framework to identify which test is being reported. The hugetlb_dio test
not only uses the same strings for every test that is run but it also uses
different strings for test passes and failures which means that test
automation is unable to follow what the test is doing at all.
Pull the existing duplicated logging of the number of free huge pages
before and after the test out of the conditional and replace that and the
logging of the result with a single ksft_print_result() which incorporates
the parameters passed into the test into the output.
Fixes: fae1980347bf ("selftests: hugetlb_dio: fixup check for initial conditions to skip in the start")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/mm/hugetlb_dio.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
index 432d5af15e66b7d6cac0273fb244d6696d7c9ddc..db63abe5ee5e85ff7795d3ea176c3ac47184bf4f 100644
--- a/tools/testing/selftests/mm/hugetlb_dio.c
+++ b/tools/testing/selftests/mm/hugetlb_dio.c
@@ -76,19 +76,15 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
/* Get the free huge pages after unmap*/
free_hpage_a = get_free_hugepages();
+ ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
+ ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
+
/*
* If the no. of free hugepages before allocation and after unmap does
* not match - that means there could still be a page which is pinned.
*/
- if (free_hpage_a != free_hpage_b) {
- ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
- ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
- ksft_test_result_fail(": Huge pages not freed!\n");
- } else {
- ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
- ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
- ksft_test_result_pass(": Huge pages freed successfully !\n");
- }
+ ksft_test_result(free_hpage_a == free_hpage_b,
+ "free huge pages from %u-%u\n", start_off, end_off);
}
int main(void)
---
base-commit: 6f3d2b5299b0a8bcb8a9405a8d3fceb24f79c4f0
change-id: 20241127-kselftest-mm-hugetlb-dio-names-1ebccbe8183d
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest: hugetlb_dio: Fix test naming
2024-11-27 16:14 [PATCH] selftest: hugetlb_dio: Fix test naming Mark Brown
@ 2024-11-28 5:16 ` Donet Tom
2024-11-28 12:44 ` Mark Brown
2024-11-28 7:14 ` Muhammad Usama Anjum
1 sibling, 1 reply; 5+ messages in thread
From: Donet Tom @ 2024-11-28 5:16 UTC (permalink / raw)
To: Mark Brown, Andrew Morton, Shuah Khan
Cc: Ritesh Harjani (IBM),
Muhammad Usama Anjum, linux-mm, linux-kselftest, linux-kernel
On 11/27/24 21:44, Mark Brown wrote:
> The string logged when a test passes or fails is used by the selftest
> framework to identify which test is being reported. The hugetlb_dio test
> not only uses the same strings for every test that is run but it also uses
> different strings for test passes and failures which means that test
> automation is unable to follow what the test is doing at all.
>
> Pull the existing duplicated logging of the number of free huge pages
> before and after the test out of the conditional and replace that and the
> logging of the result with a single ksft_print_result() which incorporates
> the parameters passed into the test into the output.
>
> Fixes: fae1980347bf ("selftests: hugetlb_dio: fixup check for initial conditions to skip in the start")
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> tools/testing/selftests/mm/hugetlb_dio.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
> index 432d5af15e66b7d6cac0273fb244d6696d7c9ddc..db63abe5ee5e85ff7795d3ea176c3ac47184bf4f 100644
> --- a/tools/testing/selftests/mm/hugetlb_dio.c
> +++ b/tools/testing/selftests/mm/hugetlb_dio.c
> @@ -76,19 +76,15 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
> /* Get the free huge pages after unmap*/
> free_hpage_a = get_free_hugepages();
>
> + ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
> + ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
> +
> /*
> * If the no. of free hugepages before allocation and after unmap does
> * not match - that means there could still be a page which is pinned.
> */
> - if (free_hpage_a != free_hpage_b) {
> - ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
> - ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
> - ksft_test_result_fail(": Huge pages not freed!\n");
> - } else {
> - ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
> - ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
> - ksft_test_result_pass(": Huge pages freed successfully !\n");
> - }
> + ksft_test_result(free_hpage_a == free_hpage_b,
> + "free huge pages from %u-%u\n", start_off, end_off);
Hi Mark
This test allocates a hugetlb buffer and adjusts the start and end offsets of the buffer based
on|start_off| and|end_off|. The adjusted buffer is then used for Direct I/O (DIO). If I understand
correctly,|start_off| and|end_off| are not free huge pages but rather DIO buffer offsets. Should we
change this message to "Hugetlb DIO buffer offset"?
Thanks
Donet
> }
>
> int main(void)
>
> ---
> base-commit: 6f3d2b5299b0a8bcb8a9405a8d3fceb24f79c4f0
> change-id: 20241127-kselftest-mm-hugetlb-dio-names-1ebccbe8183d
>
> Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest: hugetlb_dio: Fix test naming
2024-11-27 16:14 [PATCH] selftest: hugetlb_dio: Fix test naming Mark Brown
2024-11-28 5:16 ` Donet Tom
@ 2024-11-28 7:14 ` Muhammad Usama Anjum
1 sibling, 0 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-11-28 7:14 UTC (permalink / raw)
To: Mark Brown, Andrew Morton, Shuah Khan, Donet Tom
Cc: Usama.Anjum, Ritesh Harjani (IBM),
linux-mm, linux-kselftest, linux-kernel
On 11/27/24 9:14 PM, Mark Brown wrote:
> The string logged when a test passes or fails is used by the selftest
> framework to identify which test is being reported. The hugetlb_dio test
> not only uses the same strings for every test that is run but it also uses
> different strings for test passes and failures which means that test
> automation is unable to follow what the test is doing at all.
>
> Pull the existing duplicated logging of the number of free huge pages
> before and after the test out of the conditional and replace that and the
> logging of the result with a single ksft_print_result() which incorporates
> the parameters passed into the test into the output.
>
> Fixes: fae1980347bf ("selftests: hugetlb_dio: fixup check for initial conditions to skip in the start")
> Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> tools/testing/selftests/mm/hugetlb_dio.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
> index 432d5af15e66b7d6cac0273fb244d6696d7c9ddc..db63abe5ee5e85ff7795d3ea176c3ac47184bf4f 100644
> --- a/tools/testing/selftests/mm/hugetlb_dio.c
> +++ b/tools/testing/selftests/mm/hugetlb_dio.c
> @@ -76,19 +76,15 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
> /* Get the free huge pages after unmap*/
> free_hpage_a = get_free_hugepages();
>
> + ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
> + ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
> +
> /*
> * If the no. of free hugepages before allocation and after unmap does
> * not match - that means there could still be a page which is pinned.
> */
> - if (free_hpage_a != free_hpage_b) {
> - ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
> - ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
> - ksft_test_result_fail(": Huge pages not freed!\n");
> - } else {
> - ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
> - ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
> - ksft_test_result_pass(": Huge pages freed successfully !\n");
> - }
> + ksft_test_result(free_hpage_a == free_hpage_b,
> + "free huge pages from %u-%u\n", start_off, end_off);
> }
>
> int main(void)
>
> ---
> base-commit: 6f3d2b5299b0a8bcb8a9405a8d3fceb24f79c4f0
> change-id: 20241127-kselftest-mm-hugetlb-dio-names-1ebccbe8183d
>
> Best regards,
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest: hugetlb_dio: Fix test naming
2024-11-28 5:16 ` Donet Tom
@ 2024-11-28 12:44 ` Mark Brown
2024-11-28 12:58 ` Donet Tom
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2024-11-28 12:44 UTC (permalink / raw)
To: Donet Tom
Cc: Andrew Morton, Shuah Khan, Ritesh Harjani (IBM),
Muhammad Usama Anjum, linux-mm, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]
On Thu, Nov 28, 2024 at 10:46:56AM +0530, Donet Tom wrote:
> On 11/27/24 21:44, Mark Brown wrote:
> > + ksft_test_result(free_hpage_a == free_hpage_b,
> > + "free huge pages from %u-%u\n", start_off, end_off);
> This test allocates a hugetlb buffer and adjusts the start and end offsets of the buffer based
> on|start_off| and|end_off|. The adjusted buffer is then used for Direct I/O (DIO). If I understand
> correctly,|start_off| and|end_off| are not free huge pages but rather DIO buffer offsets. Should we
> change this message to "Hugetlb DIO buffer offset"?
Sure, so long as the message is consistent it doesn't really matter what
it is from the point of view of the tooling. I also noticed while doing
this that the test doesn't verify that a huge page is actually used at
any point, I was thinking about doing an incremental change for that
too.
Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns. Doing this makes your messages much
easier to read and reply to.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftest: hugetlb_dio: Fix test naming
2024-11-28 12:44 ` Mark Brown
@ 2024-11-28 12:58 ` Donet Tom
0 siblings, 0 replies; 5+ messages in thread
From: Donet Tom @ 2024-11-28 12:58 UTC (permalink / raw)
To: Mark Brown
Cc: Andrew Morton, Shuah Khan, Ritesh Harjani (IBM),
Muhammad Usama Anjum, linux-mm, linux-kselftest, linux-kernel
On 11/28/24 18:14, Mark Brown wrote:
> On Thu, Nov 28, 2024 at 10:46:56AM +0530, Donet Tom wrote:
>> On 11/27/24 21:44, Mark Brown wrote:
>>> + ksft_test_result(free_hpage_a == free_hpage_b,
>>> + "free huge pages from %u-%u\n", start_off, end_off);
>> This test allocates a hugetlb buffer and adjusts the start and end offsets of the buffer based
>> on|start_off| and|end_off|. The adjusted buffer is then used for Direct I/O (DIO). If I understand
>> correctly,|start_off| and|end_off| are not free huge pages but rather DIO buffer offsets. Should we
>> change this message to "Hugetlb DIO buffer offset"?
> Sure, so long as the message is consistent it doesn't really matter what
> it is from the point of view of the tooling. I also noticed while doing
> this that the test doesn't verify that a huge page is actually used at
> any point, I was thinking about doing an incremental change for that
> too.
Sure. Thank you.
>
> Please fix your mail client to word wrap within paragraphs at something
> substantially less than 80 columns. Doing this makes your messages much
> easier to read and reply to.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-05 15:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-27 16:14 [PATCH] selftest: hugetlb_dio: Fix test naming Mark Brown
2024-11-28 5:16 ` Donet Tom
2024-11-28 12:44 ` Mark Brown
2024-11-28 12:58 ` Donet Tom
2024-11-28 7:14 ` Muhammad Usama Anjum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox