From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com
Cc: joannelkoong@gmail.com, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 10/34] generic/759,760: skip test if we can't set up a hugepage for IO
Date: Wed, 5 Feb 2025 10:06:34 -0800 [thread overview]
Message-ID: <20250205180634.GJ21799@frogsfrogsfrogs> (raw)
In-Reply-To: <173870406261.546134.13417439080603539599.stgit@frogsfrogsfrogs>
On Tue, Feb 04, 2025 at 01:24:54PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> On an arm64 VM with 64k base pages and a paltry 8G of RAM, this test
> will frequently fail like this:
>
> > QA output created by 759
> > fsx -N 10000 -l 500000 -h
> > -fsx -N 10000 -o 8192 -l 500000 -h
> > -fsx -N 10000 -o 128000 -l 500000 -h
> > +Seed set to 1
> > +madvise collapse for buf: Cannot allocate memory
> > +init_hugepages_buf failed for good_buf: Cannot allocate memory
>
> This system has a 512MB hugepage size, which means that there's a good
> chance that memory is so fragmented that we won't be able to create a
> huge page (in 1/16th the available DRAM). Create a _run_hugepage_fsx
> helper that will detect this situation at the start of the test and skip
> it, having refactored run_fsx into a properly namespaced version that
> won't exit the test on failure.
>
> 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>
> ---
> common/rc | 34 ++++++++++++++++++++++++++++++----
> ltp/fsx.c | 6 ++++--
> tests/generic/759 | 6 +++---
> tests/generic/760 | 6 +++---
> 4 files changed, 40 insertions(+), 12 deletions(-)
>
>
> diff --git a/common/rc b/common/rc
> index b7736173e6e839..4005db776309f3 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4982,20 +4982,46 @@ _require_hugepage_fsx()
> _notrun "fsx binary does not support MADV_COLLAPSE"
> }
>
> -run_fsx()
> +_run_fsx()
> {
> - echo fsx $@
> + echo "fsx $*"
> local args=`echo $@ | sed -e "s/ BSIZE / $bsize /g" -e "s/ PSIZE / $psize /g"`
> set -- $here/ltp/fsx $args $FSX_AVOID $TEST_DIR/junk
> echo "$@" >>$seqres.full
> rm -f $TEST_DIR/junk
> "$@" 2>&1 | tee -a $seqres.full >$tmp.fsx
> - if [ ${PIPESTATUS[0]} -ne 0 ]; then
> + local res=${PIPESTATUS[0]}
> + if [ $res -ne 0 ]; then
> cat $tmp.fsx
> rm -f $tmp.fsx
> - exit 1
> + return $res
> fi
> rm -f $tmp.fsx
> + return 0
> +}
> +
> +# Run fsx with -h(ugepage buffers). If we can't set up a hugepage then skip
> +# the test, but if any other error occurs then exit the test.
> +_run_hugepage_fsx() {
> + _run_fsx "$@" -h &> $tmp.hugepage_fsx
> + local res=$?
> + if [ $res -eq 103 ]; then
> + # According to the MADV_COLLAPSE manpage, these three errors
> + # can happen if the kernel could not collapse a collection of
> + # pages into a single huge page.
> + grep -q -E ' for hugebuf: (Cannot allocate memory|Device or resource busy|Resource temporarily unavailable)' $tmp.hugepage_fsx && \
> + _notrun "Could not set up huge page for test"
> + fi
> + cat $tmp.hugepage_fsx
> + rm -f $tmp.hugepage_fsx
> + test $res -ne 0 && exit 1
> + return 0
> +}
> +
> +# run fsx or exit the test
> +run_fsx()
> +{
> + _run_fsx || exit 1
This of course should read:
_run_fsx "$@" || exit 1
and will be corrected in the next published draft.
--D
> }
>
> _require_statx()
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index cf9502a74c17a7..d1b0f245582b31 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -2974,13 +2974,15 @@ init_hugepages_buf(unsigned len, int hugepage_size, int alignment, long *buf_siz
>
> ret = posix_memalign(&buf, hugepage_size, size);
> if (ret) {
> - prterr("posix_memalign for buf");
> + /* common/rc greps this error message */
> + prterr("posix_memalign for hugebuf");
> return NULL;
> }
> memset(buf, '\0', size);
> ret = madvise(buf, size, MADV_COLLAPSE);
> if (ret) {
> - prterr("madvise collapse for buf");
> + /* common/rc greps this error message */
> + prterr("madvise collapse for hugebuf");
> free(buf);
> return NULL;
> }
> diff --git a/tests/generic/759 b/tests/generic/759
> index a7dec155056abc..49c02214559a55 100755
> --- a/tests/generic/759
> +++ b/tests/generic/759
> @@ -15,9 +15,9 @@ _require_test
> _require_thp
> _require_hugepage_fsx
>
> -run_fsx -N 10000 -l 500000 -h
> -run_fsx -N 10000 -o 8192 -l 500000 -h
> -run_fsx -N 10000 -o 128000 -l 500000 -h
> +_run_hugepage_fsx -N 10000 -l 500000
> +_run_hugepage_fsx -N 10000 -o 8192 -l 500000
> +_run_hugepage_fsx -N 10000 -o 128000 -l 500000
>
> status=0
> exit
> diff --git a/tests/generic/760 b/tests/generic/760
> index 4781a8d1eec4ec..f270636e56a377 100755
> --- a/tests/generic/760
> +++ b/tests/generic/760
> @@ -19,9 +19,9 @@ _require_hugepage_fsx
> psize=`$here/src/feature -s`
> bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
>
> -run_fsx -N 10000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W -h
> -run_fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W -h
> -run_fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W -h
> +_run_hugepage_fsx -N 10000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
> +_run_hugepage_fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
> +_run_hugepage_fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z -R -W
>
> status=0
> exit
>
>
next prev parent reply other threads:[~2025-02-05 18:06 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 21:22 [PATCHSET v2] fstests: random fixes for v2025.02.02 Darrick J. Wong
2025-02-04 21:22 ` [PATCH 01/34] generic/476: fix fsstress process management Darrick J. Wong
2025-02-04 21:22 ` [PATCH 02/34] metadump: make non-local function variables more obvious Darrick J. Wong
2025-02-04 21:23 ` [PATCH 03/34] metadump: fix cleanup for v1 metadump testing Darrick J. Wong
2025-02-04 21:23 ` [PATCH 04/34] generic/019: don't fail if fio crashes while shutting down Darrick J. Wong
2025-02-04 21:23 ` [PATCH 05/34] fuzzy: do not set _FSSTRESS_PID when exercising fsx Darrick J. Wong
2025-02-04 21:23 ` [PATCH 06/34] common/rc: revert recursive unmount in _clear_mount_stack Darrick J. Wong
2025-02-05 0:07 ` Dave Chinner
2025-02-04 21:24 ` [PATCH 07/34] common/dump: don't replace pids arbitrarily Darrick J. Wong
2025-02-05 0:09 ` Dave Chinner
2025-02-04 21:24 ` [PATCH 08/34] common/populate: correct the parent pointer name creation formulae Darrick J. Wong
2025-02-04 21:24 ` [PATCH 09/34] generic/759,760: fix MADV_COLLAPSE detection and inclusion Darrick J. Wong
2025-02-04 21:24 ` [PATCH 10/34] generic/759,760: skip test if we can't set up a hugepage for IO Darrick J. Wong
2025-02-05 18:06 ` Darrick J. Wong [this message]
2025-02-04 21:25 ` [PATCH 11/34] common/rc: create a wrapper for the su command Darrick J. Wong
2025-02-05 0:14 ` Dave Chinner
2025-02-04 21:25 ` [PATCH 12/34] fuzzy: kill subprocesses with SIGPIPE, not SIGINT Darrick J. Wong
2025-02-05 0:16 ` Dave Chinner
2025-02-05 17:38 ` Darrick J. Wong
2025-02-04 21:25 ` [PATCH 13/34] common/rc: hoist pkill to a helper function Darrick J. Wong
2025-02-05 0:17 ` Dave Chinner
2025-02-04 21:25 ` [PATCH 14/34] common: fix pkill by running test program in a separate session Darrick J. Wong
2025-02-05 0:23 ` Dave Chinner
2025-02-05 17:43 ` Darrick J. Wong
2025-02-04 21:26 ` [PATCH 15/34] check: run tests in a private pid/mount namespace Darrick J. Wong
2025-02-05 0:37 ` Dave Chinner
2025-02-05 18:00 ` Darrick J. Wong
2025-02-05 18:19 ` Darrick J. Wong
2025-02-05 21:15 ` Dave Chinner
2025-02-05 21:25 ` Darrick J. Wong
2025-02-05 21:13 ` Dave Chinner
2025-02-04 21:26 ` [PATCH 16/34] check: deprecate using process sessions to isolate test instances Darrick J. Wong
2025-02-05 0:38 ` Dave Chinner
2025-02-04 21:26 ` [PATCH 17/34] common/rc: don't copy fsstress to $TEST_DIR Darrick J. Wong
2025-02-04 21:27 ` [PATCH 18/34] unmount: resume logging of stdout and stderr for filtering Darrick J. Wong
2025-02-04 21:27 ` [PATCH 19/34] mkfs: don't hardcode log size Darrick J. Wong
2025-02-05 0:40 ` Dave Chinner
2025-02-04 21:27 ` [PATCH 20/34] common/rc: return mount_ret in _try_scratch_mount Darrick J. Wong
2025-02-05 0:42 ` Dave Chinner
2025-02-05 18:03 ` Darrick J. Wong
2025-02-04 21:27 ` [PATCH 21/34] preamble: fix missing _kill_fsstress Darrick J. Wong
2025-02-04 21:28 ` [PATCH 22/34] generic/650: revert SOAK DURATION changes Darrick J. Wong
2025-02-05 0:43 ` Dave Chinner
2025-02-04 21:28 ` [PATCH 23/34] generic/032: fix pinned mount failure Darrick J. Wong
2025-02-04 21:28 ` [PATCH 24/34] fuzzy: stop __stress_scrub_fsx_loop if fsx fails Darrick J. Wong
2025-02-05 0:44 ` Dave Chinner
2025-02-04 21:28 ` [PATCH 25/34] fuzzy: don't use readarray for xfsfind output Darrick J. Wong
2025-02-04 21:29 ` [PATCH 26/34] fuzzy: always stop the scrub fsstress loop on error Darrick J. Wong
2025-02-05 0:45 ` Dave Chinner
2025-02-04 21:29 ` [PATCH 27/34] fuzzy: port fsx and fsstress loop to use --duration Darrick J. Wong
2025-02-05 0:50 ` Dave Chinner
2025-02-05 18:08 ` Darrick J. Wong
2025-02-04 21:29 ` [PATCH 28/34] fix _require_scratch_duperemove ordering Darrick J. Wong
2025-02-05 0:51 ` Dave Chinner
2025-02-04 21:29 ` [PATCH 29/34] fsstress: fix a memory leak Darrick J. Wong
2025-02-05 0:54 ` Dave Chinner
2025-02-04 21:30 ` [PATCH 30/34] fsx: fix leaked log file pointer Darrick J. Wong
2025-02-05 0:57 ` Dave Chinner
2025-02-04 21:30 ` [PATCH 31/34] misc: don't put nr_cpus into the fsstress -n argument Darrick J. Wong
2025-02-05 1:00 ` Dave Chinner
2025-02-04 21:30 ` [PATCH 32/34] common/config: add $here to FSSTRESS_PROG Darrick J. Wong
2025-02-05 1:00 ` Dave Chinner
2025-02-04 21:30 ` [PATCH 33/34] config: add FSX_PROG variable Darrick J. Wong
2025-02-05 1:04 ` Dave Chinner
2025-02-04 21:31 ` [PATCH 34/34] build: initialize stack variables to zero by default Darrick J. Wong
2025-02-05 1:05 ` Dave Chinner
2025-02-05 12:46 ` [PATCHSET v2] fstests: random fixes for v2025.02.02 Amir Goldstein
-- strict thread matches above, loose matches on Subject: below --
2025-02-12 3:30 [PATCHSET v3] " Darrick J. Wong
2025-02-12 3:33 ` [PATCH 10/34] generic/759,760: skip test if we can't set up a hugepage for IO Darrick J. Wong
2025-02-12 18:39 ` Joanne Koong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250205180634.GJ21799@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=joannelkoong@gmail.com \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox