test/scheduler: make spdk_for_each_reactor test optional
(84ab68c
) test/scheduler: add a for_each_reactor shutdown test
Patch above added regression test for handling spdk_for_each_reactor
during shutdown, by adding constant repeat of this operation
while application is running.
Reactor event processing (especially constant) has impact on the
reactor_interrupt_run(). spdk_fd_group_wait() will almost always
execute an event, skewing the results of scheduler test.
Reactor that should have been idle, will show active usage via
/proc/stat.
Fixes #1950
This patch makes this regression test optional, and enables it
only in test that does not measure CPU utilization from the system.
The ./test/event/scheduler/scheduler.sh is the only one where it is
enabled, as it's purpose is to verify the test scheduler application.
Remaining ./test/scheduler/*.sh tests do verify CPU utilization,
so the regression test is disabled in those.
Modified the for_each_done, to for_each_reactor_start, to better
reflect the intention.
On my system enabling spdk_for_each_reactor test flag on the
scheduler application with no threads (except app thread),
consumes ~20-25% CPU from every core in CPU mask.
Meanwhile disabling it, idle cores are 100% idle
and active cores spend 100% of CPU time in usr.
Change-Id: I40eda15a748e76b95dc5441144cd8931e46edee5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15210
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
parent
cabbb25d5d
commit
88f16162e7
@ -20,6 +20,7 @@
|
|||||||
static bool g_is_running = true;
|
static bool g_is_running = true;
|
||||||
pthread_mutex_t g_sched_list_mutex = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t g_sched_list_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
#define TIMESLICE_US 100 * 1000
|
#define TIMESLICE_US 100 * 1000
|
||||||
|
static bool g_for_each_reactor = false;
|
||||||
|
|
||||||
struct sched_thread {
|
struct sched_thread {
|
||||||
struct spdk_thread *thread;
|
struct spdk_thread *thread;
|
||||||
@ -370,9 +371,9 @@ for_each_nop(void *arg1, void *arg2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
for_each_done(void *arg1, void *arg2)
|
for_each_reactor_start(void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
spdk_for_each_reactor(for_each_nop, NULL, NULL, for_each_done);
|
spdk_for_each_reactor(for_each_nop, NULL, NULL, for_each_reactor_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -385,7 +386,28 @@ test_start(void *arg1)
|
|||||||
* that any pending spdk_for_each_reactor operations are
|
* that any pending spdk_for_each_reactor operations are
|
||||||
* completed before reactors are shut down.
|
* completed before reactors are shut down.
|
||||||
*/
|
*/
|
||||||
for_each_done(NULL, NULL);
|
if (g_for_each_reactor) {
|
||||||
|
for_each_reactor_start(NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scheduler_usage(void)
|
||||||
|
{
|
||||||
|
printf(" -f Enable spdk_for_each_reactor regression test\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
scheduler_parse_arg(int ch, char *arg)
|
||||||
|
{
|
||||||
|
switch (ch) {
|
||||||
|
case 'f':
|
||||||
|
g_for_each_reactor = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -399,7 +421,7 @@ main(int argc, char **argv)
|
|||||||
opts.shutdown_cb = test_shutdown;
|
opts.shutdown_cb = test_shutdown;
|
||||||
|
|
||||||
if ((rc = spdk_app_parse_args(argc, argv, &opts,
|
if ((rc = spdk_app_parse_args(argc, argv, &opts,
|
||||||
NULL, NULL, NULL, NULL)) != SPDK_APP_PARSE_ARGS_SUCCESS) {
|
"f", NULL, scheduler_parse_arg, scheduler_usage)) != SPDK_APP_PARSE_ARGS_SUCCESS) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,10 @@ function scheduler_create_thread() {
|
|||||||
|
|
||||||
rpc=rpc_cmd
|
rpc=rpc_cmd
|
||||||
|
|
||||||
$testdir/scheduler -m 0xF -p 0x2 --wait-for-rpc &
|
# Use -f to enable spdk_for_each_reactor regression test for #2206.
|
||||||
|
# This results in constant event processing even on reactors without any SPDK threads.
|
||||||
|
# The utilization of reactors might differ from expected.
|
||||||
|
$testdir/scheduler -m 0xF -p 0x2 --wait-for-rpc -f &
|
||||||
scheduler_pid=$!
|
scheduler_pid=$!
|
||||||
trap 'killprocess $scheduler_pid; exit 1' SIGINT SIGTERM EXIT
|
trap 'killprocess $scheduler_pid; exit 1' SIGINT SIGTERM EXIT
|
||||||
waitforlisten $scheduler_pid
|
waitforlisten $scheduler_pid
|
||||||
|
Loading…
Reference in New Issue
Block a user