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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibea8e8315187ae8a3a421007d8865bbee2d7e037
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478156
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-12-17 00:19:47 -05:00 committed by Tomasz Zawadzki
parent c697cbfd9e
commit 16ea979d71

View File

@ -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;
reactor = spdk_reactor_get(spdk_env_get_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(current_core);
assert(reactor != NULL);
TAILQ_INSERT_TAIL(&reactor->threads, lw_thread, link);