Commit 16ea979d authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/event: Check if reactor scheduled thread to the correct core



Add check if reactor scheduled the thread to one of the allowed
cores correctly to _schedule_thread().

This check will be useful in the next patch and may be helpful
when we schedule SPDK thread dynamically.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibea8e8315187ae8a3a421007d8865bbee2d7e037
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478156


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent c697cbfd
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -473,9 +473,21 @@ static void
_schedule_thread(void *arg1, void *arg2)
{
	struct spdk_lw_thread *lw_thread = arg1;
	struct spdk_thread *thread;
	struct spdk_cpuset *cpumask;
	struct spdk_reactor *reactor;
	uint32_t current_core;

	current_core = spdk_env_get_current_core();

	thread = spdk_thread_get_from_ctx(lw_thread);
	cpumask = spdk_thread_get_cpumask(thread);
	if (!spdk_cpuset_get_cpu(cpumask, current_core)) {
		SPDK_ERRLOG("Thread was scheduled to the wrong core %d\n", current_core);
		assert(false);
	}

	reactor = spdk_reactor_get(spdk_env_get_current_core());
	reactor = spdk_reactor_get(current_core);
	assert(reactor != NULL);

	TAILQ_INSERT_TAIL(&reactor->threads, lw_thread, link);