perf test: Reintroduce -p/--parallel and make -S/--sequential the default

We can't default to doing parallel tests as there are tests that compete
for the same resources and thus clash, for instance tests that put in
place 'perf probe' probes, that clean the probes without regard to other
tests needs, ARM64 coresight tests, Intel PT ones, etc.

So reintroduce --p/--parallel and make -S/--sequential the default.

We need to come up with infrastructure that state which tests can't run
in parallel because they need exclusive access to some resource,
something as simple as "probes" that would then avoid 'perf probe' tests
from running while other such test is running, or make the tests more
resilient, till then we can't use parallel mode as default.

While at it, document all these options in the 'perf test' man page.

Reported-by: Adrian Hunter <adrian.hunter@intel.com>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Reported-by: James Clark <james.clark@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/Ziwm18BqIn_vc1vn@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2024-04-26 17:26:26 -03:00
parent 450f941ea9
commit 8c618b58c8
2 changed files with 19 additions and 2 deletions

View File

@ -31,9 +31,20 @@ OPTIONS
--verbose:: --verbose::
Be more verbose. Be more verbose.
-S::
--sequential::
Run tests one after the other, this is the default mode.
-p::
--parallel::
Run tests in parallel, speeds up the whole process but is not safe with
the current infrastructure, where some tests that compete for some resources,
for instance, 'perf probe' tests that add/remove probes or clean all probes, etc.
-F:: -F::
--dont-fork:: --dont-fork::
Do not fork child for each test, run all tests within single process. Do not fork child for each test, run all tests within single process, this
sets sequential mode.
--dso:: --dso::
Specify a DSO for the "Symbols" test. Specify a DSO for the "Symbols" test.

View File

@ -40,7 +40,10 @@
*/ */
static bool dont_fork; static bool dont_fork;
/* Don't fork the tests in parallel and wait for their completion. */ /* Don't fork the tests in parallel and wait for their completion. */
static bool sequential; static bool sequential = true;
/* Do it in parallel, lacks infrastructure to avoid running tests that clash for resources,
* So leave it as the developers choice to enable while working on the needed infra */
static bool parallel;
const char *dso_to_test; const char *dso_to_test;
const char *test_objdump_path = "objdump"; const char *test_objdump_path = "objdump";
@ -536,6 +539,7 @@ int cmd_test(int argc, const char **argv)
"be more verbose (show symbol address, etc)"), "be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('F', "dont-fork", &dont_fork, OPT_BOOLEAN('F', "dont-fork", &dont_fork,
"Do not fork for testcase"), "Do not fork for testcase"),
OPT_BOOLEAN('p', "parallel", &parallel, "Run the tests in parallel"),
OPT_BOOLEAN('S', "sequential", &sequential, OPT_BOOLEAN('S', "sequential", &sequential,
"Run the tests one after another rather than in parallel"), "Run the tests one after another rather than in parallel"),
OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"), OPT_STRING('w', "workload", &workload, "work", "workload to run for testing"),
@ -566,6 +570,8 @@ int cmd_test(int argc, const char **argv)
if (dont_fork) if (dont_fork)
sequential = true; sequential = true;
else if (parallel)
sequential = false;
symbol_conf.priv_size = sizeof(int); symbol_conf.priv_size = sizeof(int);
symbol_conf.try_vmlinux_path = true; symbol_conf.try_vmlinux_path = true;