Spdk/test/event/scheduler/scheduler.sh

47 lines
1.9 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2021 Intel Corporation
# All rights reserved.
#
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
function scheduler_create_thread() {
$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x1 -a 100
$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x2 -a 100
$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x4 -a 100
$rpc --plugin scheduler_plugin scheduler_thread_create -n active_pinned -m 0x8 -a 100
$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x1 -a 0
$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x2 -a 0
$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x4 -a 0
$rpc --plugin scheduler_plugin scheduler_thread_create -n idle_pinned -m 0x8 -a 0
$rpc --plugin scheduler_plugin scheduler_thread_create -n one_third_active -a 30
thread_id=$($rpc --plugin scheduler_plugin scheduler_thread_create -n half_active -a 0)
$rpc --plugin scheduler_plugin scheduler_thread_set_active $thread_id 50
thread_id=$($rpc --plugin scheduler_plugin scheduler_thread_create -n deleted -a 100)
$rpc --plugin scheduler_plugin scheduler_thread_delete $thread_id
}
rpc=rpc_cmd
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>
2022-11-02 14:38:31 +00:00
# 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=$!
trap 'killprocess $scheduler_pid; exit 1' SIGINT SIGTERM EXIT
waitforlisten $scheduler_pid
$rpc framework_set_scheduler dynamic
$rpc framework_start_init
# basic integrity test
run_test "scheduler_create_thread" scheduler_create_thread
trap - SIGINT SIGTERM EXIT
killprocess $scheduler_pid