Commit cc8a75c4 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

event/scheduler: allow framework_get_scheduler before initialization



It was always possible to configure scheduler before subsystem
initialization, but never possible to retrieve its configuration
at that time.
Reason for this mismatch might have been omission or 'null'
scheduler pointing to the default one until subsystems are initialized.

Leave it as it is for now, but allow to retrieve scheduler configuration
at the same time as it is possible to configure it.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id5a896b2dc329e891690099e9ad45bf3f01a09bd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23955


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 74606c13
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -552,7 +552,8 @@ rpc_framework_get_scheduler(struct spdk_jsonrpc_request *request,
	spdk_json_write_object_end(w);
	spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("framework_get_scheduler", rpc_framework_get_scheduler, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("framework_get_scheduler", rpc_framework_get_scheduler,
		  SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)

static void
rpc_framework_get_governor(struct spdk_jsonrpc_request *request,
+9 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ source "$testdir/common.sh"
rpc=rpc_cmd

function scheduler_opts() {
	"${SPDK_APP[@]}" -m "$spdk_cpumask" &
	"${SPDK_APP[@]}" -m "$spdk_cpumask" --wait-for-rpc &
	spdk_pid=$!
	trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT
	waitforlisten $spdk_pid
@@ -32,16 +32,23 @@ function scheduler_opts() {
	$rpc framework_set_scheduler dynamic
	[[ "$($rpc framework_get_scheduler | jq -r '. | select(.scheduler_name == "dynamic") | .core_limit')" -eq 42 ]]

	# All the above configuration can happen before subsystems initialize
	$rpc framework_start_init

	trap - SIGINT SIGTERM EXIT
	killprocess $spdk_pid
}

function static_as_default() {
	"${SPDK_APP[@]}" -m "$spdk_cpumask" &
	"${SPDK_APP[@]}" -m "$spdk_cpumask" --wait-for-rpc &
	spdk_pid=$!
	trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT
	waitforlisten $spdk_pid

	# Before initialization scheduler is set to NULL. If unchanged, set to static
	# during subsystem initialization.
	[[ "$($rpc framework_get_scheduler | jq -r '. | select(.scheduler_name == null)')" ]]
	$rpc framework_start_init
	[[ "$($rpc framework_get_scheduler | jq -r '.scheduler_name')" == "static" ]]

	# It should never be possible to return to static scheduler after changing it