thread: fix crash on non-contiguous cpu range in cpumask
Limit the thread scheduler to put spdk_threads on lcores < last_lcore instead of lcores < lcore_count, which was probably the original intent. When the cpumask was not a contiguous cpu range, the thread scheduler failed to schedule any spdk_threads on the last cores. There was one hardcoded thread created for each reactor, but the scheduler could squash some of those into a single reactor. This broke the legacy lcore-based messages as those expect there to be at least one spdk_thread per lcore. Any spdk_poller_register() or spdk_get_io_channel() called from such a legacy message would fail an assertion, as spdk_get_thread() returned NULL. Fixes #743 Change-Id: I81a3f76d9c4788596c697df6ff51b264b99ce10b Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450353 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
7b266460d0
commit
1c297d7e30
@ -371,7 +371,7 @@ spdk_reactor_schedule_thread(struct spdk_thread *thread)
|
||||
memset(lw_thread, 0, sizeof(*lw_thread));
|
||||
|
||||
pthread_mutex_lock(&g_scheduler_mtx);
|
||||
if (g_next_core > spdk_env_get_core_count()) {
|
||||
if (g_next_core > spdk_env_get_last_core()) {
|
||||
g_next_core = spdk_env_get_first_core();
|
||||
}
|
||||
core = g_next_core;
|
||||
|
Loading…
Reference in New Issue
Block a user