scheduler: prevent user from switching back to static

Prevent user from switching back to static scheduler after
different scheduler has been selected. Currently we
do not have a way to save initial thread distribution
configuration, so each time user switches from dynamic
scheduler back to static, the SPDK threads may end up on
different reactors. This would cause discrepancy in
performance statistics of SPDK managed by static scheduler.

Change-Id: Ic17a6be55eaea0e1a748f92e01f7075540403637
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15055
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Krzysztof Karas 2022-10-19 09:45:03 +00:00 committed by Tomasz Zawadzki
parent bdc683aaa9
commit a74c8c2e8c
2 changed files with 16 additions and 1 deletions

View File

@ -2,6 +2,11 @@
## v23.01: (Upcoming Release)
### scheduler
Changing scheduler from dynamic back to static is no longer possible,
as there is no way of saving original SPDK thread distribution on reactors.
## v22.09
### accel

View File

@ -465,6 +465,17 @@ rpc_framework_set_scheduler(struct spdk_jsonrpc_request *request,
goto end;
}
scheduler = spdk_scheduler_get();
/* SPDK does not support changing scheduler back to static. */
if (scheduler != NULL && (strcmp(req.name, "static") == 0) &&
strcmp(scheduler->name, "static") != 0) {
spdk_jsonrpc_send_error_response(request,
SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Static scheduler cannot be re-enabled "
"after a different scheduler was selected");
goto end;
}
if (req.period != 0) {
spdk_scheduler_set_period(req.period);
}
@ -476,7 +487,6 @@ rpc_framework_set_scheduler(struct spdk_jsonrpc_request *request,
goto end;
}
scheduler = spdk_scheduler_get();
if (scheduler != NULL && scheduler->set_opts != NULL) {
ret = scheduler->set_opts(params);
}