Message ID | 173933094492.1758477.14479485917819478634.stgit@frogsfrogsfrogs (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/34] generic/476: fix fsstress process management | expand |
On Tue, Feb 11, 2025 at 7:33 PM Darrick J. Wong <djwong@kernel.org> wrote: > > From: Darrick J. Wong <djwong@kernel.org> > > On systems with "old" C libraries such as glibc 2.36 in Debian 12, the > MADV_COLLAPSE flag might not be defined in any of the header files > pulled in by sys/mman.h, which means that the fsx binary might not get > built with any of the MADV_COLLAPSE code. If the kernel supports THP, > the test will fail with: > > > QA output created by 760 > > fsx -N 10000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W -h > > -fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W -h > > -fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W -h > > +mapped writes DISABLED > > +MADV_COLLAPSE not supported. Can't support -h > > Fix both tests to detect fsx binaries that don't support MADV_COLLAPSE, > then fix fsx.c to include the mman.h from the kernel headers (aka > linux/mman.h) so that we can actually test IOs to and from THPs if the > kernel is newer than the rest of userspace. > > Cc: <fstests@vger.kernel.org> # v2025.02.02 > Cc: joannelkoong@gmail.com > Fixes: 627289232371e3 ("generic: add tests for read/writes from hugepages-backed buffers") > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Joanne Koong <joannelkoong@gmail.com> > --- > common/rc | 5 +++++ > ltp/fsx.c | 1 + > tests/generic/759 | 1 + > tests/generic/760 | 1 + > 4 files changed, 8 insertions(+) > > > diff --git a/common/rc b/common/rc > index 07646927bad523..b7736173e6e839 100644 > --- a/common/rc > +++ b/common/rc > @@ -4976,6 +4976,11 @@ _get_page_size() > echo $(getconf PAGE_SIZE) > } > > +_require_hugepage_fsx() > +{ > + $here/ltp/fsx -N 0 -h $TEST_DIR 2>&1 | grep -q 'MADV_COLLAPSE not supported' && \ > + _notrun "fsx binary does not support MADV_COLLAPSE" > +} > > run_fsx() > { > diff --git a/ltp/fsx.c b/ltp/fsx.c > index 634c496ffe9317..cf9502a74c17a7 100644 > --- a/ltp/fsx.c > +++ b/ltp/fsx.c > @@ -20,6 +20,7 @@ > #include <strings.h> > #include <sys/file.h> > #include <sys/mman.h> > +#include <linux/mman.h> > #include <sys/uio.h> > #include <stdbool.h> > #ifdef HAVE_ERR_H > diff --git a/tests/generic/759 b/tests/generic/759 > index 6c74478aa8a0e0..a7dec155056abc 100755 > --- a/tests/generic/759 > +++ b/tests/generic/759 > @@ -13,6 +13,7 @@ _begin_fstest rw auto quick > > _require_test > _require_thp > +_require_hugepage_fsx > > run_fsx -N 10000 -l 500000 -h > run_fsx -N 10000 -o 8192 -l 500000 -h > diff --git a/tests/generic/760 b/tests/generic/760 > index c71a196222ad3b..4781a8d1eec4ec 100755 > --- a/tests/generic/760 > +++ b/tests/generic/760 > @@ -14,6 +14,7 @@ _begin_fstest rw auto quick > _require_test > _require_odirect > _require_thp > +_require_hugepage_fsx > > psize=`$here/src/feature -s` > bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV` >
diff --git a/common/rc b/common/rc index 07646927bad523..b7736173e6e839 100644 --- a/common/rc +++ b/common/rc @@ -4976,6 +4976,11 @@ _get_page_size() echo $(getconf PAGE_SIZE) } +_require_hugepage_fsx() +{ + $here/ltp/fsx -N 0 -h $TEST_DIR 2>&1 | grep -q 'MADV_COLLAPSE not supported' && \ + _notrun "fsx binary does not support MADV_COLLAPSE" +} run_fsx() { diff --git a/ltp/fsx.c b/ltp/fsx.c index 634c496ffe9317..cf9502a74c17a7 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -20,6 +20,7 @@ #include <strings.h> #include <sys/file.h> #include <sys/mman.h> +#include <linux/mman.h> #include <sys/uio.h> #include <stdbool.h> #ifdef HAVE_ERR_H diff --git a/tests/generic/759 b/tests/generic/759 index 6c74478aa8a0e0..a7dec155056abc 100755 --- a/tests/generic/759 +++ b/tests/generic/759 @@ -13,6 +13,7 @@ _begin_fstest rw auto quick _require_test _require_thp +_require_hugepage_fsx run_fsx -N 10000 -l 500000 -h run_fsx -N 10000 -o 8192 -l 500000 -h diff --git a/tests/generic/760 b/tests/generic/760 index c71a196222ad3b..4781a8d1eec4ec 100755 --- a/tests/generic/760 +++ b/tests/generic/760 @@ -14,6 +14,7 @@ _begin_fstest rw auto quick _require_test _require_odirect _require_thp +_require_hugepage_fsx psize=`$here/src/feature -s` bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`