All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Nirjhar Roy <nirjhar@linux.ibm.com>
Cc: fstests@vger.kernel.org, zlang@kernel.org
Subject: Re: [PATCH 13/28] check-parallel: introduce config file support
Date: Wed, 21 May 2025 22:23:00 +1000	[thread overview]
Message-ID: <aC3FpDihoZzkuwhs@dread.disaster.area> (raw)
In-Reply-To: <077e031f6b6b179c9b5dabf284e3015c37dc3367.camel@linux.ibm.com>

On Fri, May 09, 2025 at 05:31:49PM +0530, Nirjhar Roy wrote:
> On Thu, 2025-04-17 at 13:00 +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > check-parallel will use the same config file format check does,
> > and use the same code to auto-discover the config file.
> > 
> > The biggest difference is that check-parallel -requires- the use
> > of config sections, and the first section *must* be named
> > "[check-parallel]". This first section is used for defining
> > setup parameters for check parallel - loop device image file sizes,
> > etc.
> > 
> > The second biggest difference is that check-parallel does not allow
> > the config file to define devices. Any section found to contain a
> > device definition such as TEST_DEV or SCRATCH_DEV will result
> > check-parallel terminating with an error.
> > 
> > This config file format works for check-parallel invoking check,
> > too, because once a section is specified on the check command line,
> > it effectively ignores unknown values set in sections that it
> > doesn't run.  Hence it effectively skips over the [check-parallel]
> > setup section.
> > 
> > For check-parallel, each config section now defines just the
> > filesystem configuration to be tested; all the usual mount and mkfs
> > options apply, and USE_EXTERNAL must be set for testing external
> > devices.
> > 
> > This commit implements the initial [check-parallel] section support
> > and moves the build in default values for these parameters to the
> > config file setup. This means if the config file does not contain
> > all the necessary parameter values, a default value will be used for
> > it.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
....

> > @@ -388,3 +408,51 @@ _config_section_setup()
> >  		fi
> >  	fi
> >  }
> > +
> > +# check-parallel config files must:
> > +# 1. have config sections defined
> > +# 2. use the first config section for check-parallel setup
> > +# 3. not define any physical device parameter in any section
> Nit: Maybe some documentation of the above restrictions and some new
> variables introduced (like SCRATCH_DEV_SIZE, ..)in the README?

Eventually, yes. Right now stuff is still in a state of flux, so
there is no point in adding extra documentation that has to be kept
up to date.

> > +# If all these are true, then we read the first section that defines
> > +# the check-parallel config parameters and continue onwards.
> > +_config_setup_parallel()
> > +{
> > +	if [ "$iam" != "check-parallel" ]; then
> > +		echo "$iam: incorrect config file format chosen!"
> > +		exit 1;
> > +	fi
> > +
> > +	_config_file_setup
> > +
> > +	if [ "$OPTIONS_HAVE_SECTIONS" != "true" ]; then
> Most of the places the way OPTIONS_HAVE_SECTIONS is being used is as 
> if $OPTIONS_HAVE_SECTIONS; then 
>     ...
> fi
> 
> so, when OPTIONS_HAVE_SECTIONS=true, /bin/true is executed and the exit
> code of /bin/true is always a success and it is not a string comparison
> with "true" or "false".

Yes, I know.

Executing /bin/true requires creating a new process just to return
a successful exit code. This takes several milliseconds of CPU time
to create and tear down a new process context.

OTOH, doing a string comparison in the shell parser takes a couple
of microseconds of CPU time....

Which is faster and burns less energy?

>
> /bin/true always succeeds and hence if
> OPTIONS_HAVE_SECTIONS=true, then 
> if $OPTIONS_HAVE_SECTIONS is always executed. In the same way
> /bin/false always has a failure code upon exit.
> So maybe we should change this to 
> if $OPTIONS_HAVE_SECTIONS; then - just to have consistency with the
> rest of the code?
> > +		echo "$iam config file has no sections!"
> > +		exit 1;
> > +	fi
> > +
> > +	local first_section=`echo $HOST_OPTIONS_SECTIONS | cut -f1 -d" "`
> > +	if [ "$first_section" != "$iam" ]; then
> > +		echo "$iam config file has no [$iam] section"
> > +		exit 1
> > +	fi
> > +
> > +	grep DEV $HOST_OPTIONS |grep -qv SIZE
> This will incorrectly fail the check-parallel invocation even if we
> have the devices defined in the comment section - so something like the
> following is causing a failure
> 
> local.config >>
> [check-parallel]
> TEST_DEV_SIZE=2G
> #TEST_DEV=/dev/loop0

Don't put devices in the check-parallel config file.

> Maybe we should try to ignore the lines that begin with '#'
> something like - grep -v '^[[:space:]]*#' $HOST_OPTIONS | grep DEV |
> grep -qv SIZE ? 
> 
> Another case:
> 
> Let us consider another local.config file:
> 
> [check-parallel]
> TEST_DEV_SIZE=2G
> 
> [xfs_4k]
> TEST_DEV=/dev/loop0
> TEST_DIR=/mnt1/test
> SCRATCH_DEV=/dev/loop1
> SCRATCH_MNT=/mnt1/scratch
> 
> The above file runs fine ./check -s xfs_4k selftest/001

Yes, but it is an invalid check-parallel config file because it has
devices defined in it.

If check-parallel allows this, then when it runs a check instance
it will override the environment defines set by the check-parallel
runner and every runner will try to use the same devices and mount
points.

It just doesn't work.

> However, with check-parallel, it will fail and it is expected according
> to the design. But is there any specific reason to fail when the above
> configuration is perfectly suitable to run check-parallel (we have
> check-parallel, section defined)? So 
> 
> ./check-parallel -s check-parralel -D /mnt1 -x stress -t 1 selftest/001
> check-parallel config file has devices defined
>
> Instead of grepping on the entire $HOST_OPTIONS, how about we only grep
> on the check-parallel section? In this way we parse/export the
> environment variables only in check-parallel section and ignore the
> sections that have devices defined and/or check-parallel incompatible.
> ./check -s xfs_4k works anyway with [check-parallel] section defined.
> ./check -s check-parallel will fail with *DEVs not defined which is
> self explanatory.

I think you may have misunderstood the direction check-parallel is
going in.

I don't want check and check-parallel to share the same config file.
What I need is for them to use the same file format and hence be
able to share parser code.

Later in the patchset I remove the dependency that check-parallel
has on check, and at that point the check-parallel config file no
longer needs to work with check.

However, there is an intermediate period in the patchset where
check-parallel calls check, and so the config file for
check-parallel has to be compatible with check for at least that
short period in time.

To make that work, the check-parallel config file cannot have any
devices or mount points defined anywhere in it, otherwise check will
override the values that check-parallel has provided via the
environment. We don't need to over-engineer this check - if there
are any known devices defined in the config file, abort.

If it gets a false positive, I don't care because once
check-parallel no longer calls check, the "no devices in
check-parallel config file" rule becomes irrelevant because the
config files are no longer shared. At this point the config file
supports only the subset of parameters that check-parallel defines
as valid, and no more. This set of valid parameters for
check-parallel will be enumerated in future patches.

Hence all we have to do at this point is make sure that the section
parser continues to work correctly for both test runners, not try to
invent the One True Config File To Rule Them All....

> > +	parse_config_section $1
> What value is $1 holding? _config_setup_parallel is being called only
> from check-parallel without any parameters passed, right? Did you mean
> _config_setup_parallel $first_section ?

Yup. Fixed.

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2025-05-21 12:23 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17  3:00 [PATCH 00/28] check-parallel: Running tests without check Dave Chinner
2025-04-17  3:00 ` [PATCH 01/28] fstests: remove support for non-numeric test names Dave Chinner
2025-04-30  9:17   ` Nirjhar Roy (IBM)
2025-05-21  2:39     ` Dave Chinner
2025-05-26  5:14       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 02/28] _scratch_mkfs_sized: obey USE_EXTERNAL for XFS filesystems Dave Chinner
2025-05-05  6:14   ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 03/28] fstests: move test exit functions to common/exit Dave Chinner
2025-04-17  3:00 ` [PATCH 04/28] check-parallel: report how many tests were _notrun Dave Chinner
2025-05-05  9:58   ` Nirjhar Roy (IBM)
2025-05-21  2:53     ` Dave Chinner
2025-05-26  6:09       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 05/28] check: factor out test list building code Dave Chinner
2025-05-06 11:32   ` Nirjhar Roy (IBM)
2025-05-21  3:55     ` Dave Chinner
2025-05-26  6:48       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 06/28] check-parallel: use common group list parsing code Dave Chinner
2025-05-06 15:56   ` Nirjhar Roy (IBM)
2025-05-21  4:13     ` Dave Chinner
2025-05-26  6:58       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 07/28] check-parallel: adjust concurrency according to CPU count Dave Chinner
2025-05-07  6:45   ` Nirjhar Roy (IBM)
2025-05-21  4:32     ` Dave Chinner
2025-05-26  8:50       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 08/28] check-parallel: add logwrite device support Dave Chinner
2025-05-07  8:18   ` Nirjhar Roy (IBM)
2025-05-21 10:07     ` Dave Chinner
2025-05-26  8:59       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 09/28] check-parallel: allow FSTYP selection from the CLI Dave Chinner
2025-05-07  8:49   ` Nirjhar Roy (IBM)
2025-05-21 10:17     ` Dave Chinner
2025-05-26  9:00       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 10/28] check-parallel: use PID namespaces for runner process isolation Dave Chinner
2025-05-07  9:02   ` Nirjhar Roy (IBM)
2025-05-21 10:19     ` Dave Chinner
2025-05-26  9:04       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 11/28] check-parallel: initial support for specifying device sizes Dave Chinner
2025-05-07 10:05   ` Nirjhar Roy (IBM)
2025-05-21 11:11     ` Dave Chinner
2025-04-17  3:00 ` [PATCH 12/28] config: move config section code to it's own file Dave Chinner
2025-05-09  6:09   ` Nirjhar Roy
2025-05-21 11:28     ` Dave Chinner
2025-04-17  3:00 ` [PATCH 13/28] check-parallel: introduce config file support Dave Chinner
2025-05-09 12:01   ` Nirjhar Roy
2025-05-21 12:23     ` Dave Chinner [this message]
2025-04-17  3:00 ` [PATCH 14/28] fstests: further separate sourcing common/rc and common/config from initialisation Dave Chinner
2025-05-10 14:08   ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 15/28] check-parallel: de-batch test execution Dave Chinner
2025-05-09 13:16   ` Nirjhar Roy
2025-04-17  3:00 ` [PATCH 16/28] check-parallel: run sections directly Dave Chinner
2025-05-09 14:03   ` Nirjhar Roy
2025-04-17  3:00 ` [PATCH 17/28] check-parallel: rebuild test list when FSTYP changes Dave Chinner
2025-05-09 16:00   ` Nirjhar Roy
2025-04-17  3:00 ` [PATCH 18/28] check-parallel: create a "results-latest" symlink Dave Chinner
2025-05-10 13:12   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 19/28] check: factor test running Dave Chinner
2025-05-12 13:57   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 20/28] [RFC] check-parallel: run tests directly without using check Dave Chinner
2025-05-13 14:48   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 21/28] generic/531: limit max files per CPU Dave Chinner
2025-05-10 13:15   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 22/28] fsync-tester.c: use syncfs() rather than sync() Dave Chinner
2025-04-30  9:08   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 23/28] open-by-handle.c: " Dave Chinner
2025-04-30  9:02   ` Nirjhar Roy (IBM)
2025-05-21  2:32     ` Dave Chinner
2025-05-26  5:11       ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 24/28] " Dave Chinner
2025-04-30  8:56   ` Nirjhar Roy (IBM)
2025-05-21  2:30     ` Dave Chinner
2025-05-26  4:56       ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 25/28] bulkstat_unlink_test_modified.c: remove unused test code Dave Chinner
2025-04-30  8:47   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 26/28] stale-handle.c: use syncfs() rather than sync() Dave Chinner
2025-04-30  8:34   ` Nirjhar Roy (IBM)
2025-05-21  2:24     ` Dave Chinner
2025-04-17  3:01 ` [PATCH 27/28] scaleread: remove dead test code Dave Chinner
2025-04-30  8:10   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 28/28] xfs/259: no need to call sync Dave Chinner
2025-04-30  7:56   ` Nirjhar Roy (IBM)

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=aC3FpDihoZzkuwhs@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=nirjhar@linux.ibm.com \
    --cc=zlang@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.