Commit a74c8c2e authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

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: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15055


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent bdc683aa
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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
+11 −1
Original line number Diff line number Diff line
@@ -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);
	}