Message ID | 20241110064903.23626-1-donettom@linux.ibm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | selftests: hugetlb_dio: Fixup Check for initial conditions to skip in the start | expand |
On 11/10/24 12:19, Donet Tom wrote: > This test verifies that a hugepage, used as a user buffer for > DIO operations, is correctly freed upon unmapping. To test this, > we read the count of free hugepages before and after the mmap, > DIO, and munmap operations, then check if the free hugepage count > is the same. > > Reading free hugepages before the test was removed by commit > 0268d4579901 ('selftests: hugetlb_dio: check for initial conditions > to skip at the start'), causing the test to always fail. > > This patch adds back reading the free hugepages before starting > the test. With this patch, the tests are now passing. > > Test Results without this patch > > ./tools/testing/selftests/mm/hugetlb_dio > TAP version 13 > 1..4 > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 1 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 2 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 3 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 4 : Huge pages not freed! > # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0 > > Test results with this patch. > > ./tools/testing/selftests/mm/hugetlb_dio > TAP version 13 > 1..4 > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 1 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 2 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 3 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 4 : Huge pages not freed! > # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0 > > Fixes: 0268d4579901 ("selftests: hugetlb_dio: check for initial conditions to skip in the start") > Signed-off-by: Donet Tom <donettom@linux.ibm.com> > --- > tools/testing/selftests/mm/hugetlb_dio.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c > index 60001c142ce9..432d5af15e66 100644 > --- a/tools/testing/selftests/mm/hugetlb_dio.c > +++ b/tools/testing/selftests/mm/hugetlb_dio.c > @@ -44,6 +44,13 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off) > if (fd < 0) > ksft_exit_fail_perror("Error opening file\n"); > > + /* Get the free huge pages before allocation */ > + free_hpage_b = get_free_hugepages(); > + if (free_hpage_b == 0) { > + close(fd); > + ksft_exit_skip("No free hugepage, exiting!\n"); > + } > + > /* Allocate a hugetlb page */ > orig_buffer = mmap(NULL, h_pagesize, mmap_prot, mmap_flags, -1, 0); > if (orig_buffer == MAP_FAILED) { > > Hi Andrew Would you prefer I send this fixup patch as a new series, or is it okay as is? Thanks Donet
On 11/10/24 12:19, Donet Tom wrote: > This test verifies that a hugepage, used as a user buffer for > DIO operations, is correctly freed upon unmapping. To test this, > we read the count of free hugepages before and after the mmap, > DIO, and munmap operations, then check if the free hugepage count > is the same. > > Reading free hugepages before the test was removed by commit > 0268d4579901 ('selftests: hugetlb_dio: check for initial conditions > to skip at the start'), causing the test to always fail. > > This patch adds back reading the free hugepages before starting > the test. With this patch, the tests are now passing. > > Test Results without this patch > > ./tools/testing/selftests/mm/hugetlb_dio > TAP version 13 > 1..4 > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 1 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 2 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 3 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 4 : Huge pages not freed! > # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0 > > Test results with this patch. Sorry the test results with this patch is below. Test results With this patch /tools/testing/selftests/mm/hugetlb_dio TAP version 13 1..4 # No. Free pages before allocation : 100 # No. Free pages after munmap : 100 ok 1 : Huge pages freed successfully ! # No. Free pages before allocation : 100 # No. Free pages after munmap : 100 ok 2 : Huge pages freed successfully ! # No. Free pages before allocation : 100 # No. Free pages after munmap : 100 ok 3 : Huge pages freed successfully ! # No. Free pages before allocation : 100 # No. Free pages after munmap : 100 ok 4 : Huge pages freed successfully ! # Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0 Thank Donet > > ./tools/testing/selftests/mm/hugetlb_dio > TAP version 13 > 1..4 > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 1 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 2 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 3 : Huge pages not freed! > # No. Free pages before allocation : 0 > # No. Free pages after munmap : 100 > not ok 4 : Huge pages not freed! > # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0 > > Fixes: 0268d4579901 ("selftests: hugetlb_dio: check for initial conditions to skip in the start") > Signed-off-by: Donet Tom <donettom@linux.ibm.com> > --- > tools/testing/selftests/mm/hugetlb_dio.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c > index 60001c142ce9..432d5af15e66 100644 > --- a/tools/testing/selftests/mm/hugetlb_dio.c > +++ b/tools/testing/selftests/mm/hugetlb_dio.c > @@ -44,6 +44,13 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off) > if (fd < 0) > ksft_exit_fail_perror("Error opening file\n"); > > + /* Get the free huge pages before allocation */ > + free_hpage_b = get_free_hugepages(); > + if (free_hpage_b == 0) { > + close(fd); > + ksft_exit_skip("No free hugepage, exiting!\n"); > + } > + > /* Allocate a hugetlb page */ > orig_buffer = mmap(NULL, h_pagesize, mmap_prot, mmap_flags, -1, 0); > if (orig_buffer == MAP_FAILED) {
On Sun, 10 Nov 2024 12:22:12 +0530 Donet Tom <donettom@linux.ibm.com> wrote: > > Fixes: 0268d4579901 ("selftests: hugetlb_dio: check for initial conditions to skip in the start") > > ... > > Would you prefer I send this fixup patch as a new series, or is it okay as is? All looks good, thanks. I added cc:stable, because 0268d4579901 was cc:stable.
diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c index 60001c142ce9..432d5af15e66 100644 --- a/tools/testing/selftests/mm/hugetlb_dio.c +++ b/tools/testing/selftests/mm/hugetlb_dio.c @@ -44,6 +44,13 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off) if (fd < 0) ksft_exit_fail_perror("Error opening file\n"); + /* Get the free huge pages before allocation */ + free_hpage_b = get_free_hugepages(); + if (free_hpage_b == 0) { + close(fd); + ksft_exit_skip("No free hugepage, exiting!\n"); + } + /* Allocate a hugetlb page */ orig_buffer = mmap(NULL, h_pagesize, mmap_prot, mmap_flags, -1, 0); if (orig_buffer == MAP_FAILED) {
This test verifies that a hugepage, used as a user buffer for DIO operations, is correctly freed upon unmapping. To test this, we read the count of free hugepages before and after the mmap, DIO, and munmap operations, then check if the free hugepage count is the same. Reading free hugepages before the test was removed by commit 0268d4579901 ('selftests: hugetlb_dio: check for initial conditions to skip at the start'), causing the test to always fail. This patch adds back reading the free hugepages before starting the test. With this patch, the tests are now passing. Test Results without this patch ./tools/testing/selftests/mm/hugetlb_dio TAP version 13 1..4 # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 1 : Huge pages not freed! # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 2 : Huge pages not freed! # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 3 : Huge pages not freed! # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 4 : Huge pages not freed! # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0 Test results with this patch. ./tools/testing/selftests/mm/hugetlb_dio TAP version 13 1..4 # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 1 : Huge pages not freed! # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 2 : Huge pages not freed! # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 3 : Huge pages not freed! # No. Free pages before allocation : 0 # No. Free pages after munmap : 100 not ok 4 : Huge pages not freed! # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:0 error:0 Fixes: 0268d4579901 ("selftests: hugetlb_dio: check for initial conditions to skip in the start") Signed-off-by: Donet Tom <donettom@linux.ibm.com> --- tools/testing/selftests/mm/hugetlb_dio.c | 7 +++++++ 1 file changed, 7 insertions(+)