lib/event: handle error before balance()
Make sure to cancel the scheduling during: 1) gather_metrics error (already present) 2) setting the scheduler to NULL (new) 3) shutdown of the application (new) In all of the above scheduler cannot proceed to the balance() function. Prior to this patch lack of setting g_scheduling_in_progress to false would block _start_subsystem_fini() from proceeding. Resuling in application never shutting down. thread_infos are allocated during gather_metrics, and freed on threads_reschedule. The added cleanup is used during 1) and 2). Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I5ab77c85aaa9f94bd4e1a1660b55ab2f2c47bbdc Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9326 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
a03bc55669
commit
b518cbe2d4
@ -748,23 +748,36 @@ _reactors_scheduler_update_core_mode(void *ctx)
|
||||
_reactors_scheduler_fini();
|
||||
}
|
||||
|
||||
static void
|
||||
_reactors_scheduler_cancel(void *arg1, void *arg2)
|
||||
{
|
||||
struct spdk_scheduler_core_info *core;
|
||||
uint32_t i;
|
||||
|
||||
SPDK_ENV_FOREACH_CORE(i) {
|
||||
core = &g_core_infos[i];
|
||||
core->threads_count = 0;
|
||||
free(core->thread_infos);
|
||||
core->thread_infos = NULL;
|
||||
}
|
||||
|
||||
g_scheduling_in_progress = false;
|
||||
}
|
||||
|
||||
static void
|
||||
_reactors_scheduler_balance(void *arg1, void *arg2)
|
||||
{
|
||||
struct spdk_scheduler *scheduler = _spdk_scheduler_get();
|
||||
|
||||
if (g_reactor_state == SPDK_REACTOR_STATE_RUNNING && scheduler != NULL) {
|
||||
scheduler->balance(g_core_infos, g_reactor_count);
|
||||
|
||||
g_scheduler_core_number = spdk_env_get_first_core();
|
||||
_reactors_scheduler_update_core_mode(NULL);
|
||||
if (g_reactor_state != SPDK_REACTOR_STATE_RUNNING || scheduler == NULL) {
|
||||
_reactors_scheduler_cancel(NULL, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_reactors_scheduler_cancel(void *arg1, void *arg2)
|
||||
{
|
||||
g_scheduling_in_progress = false;
|
||||
scheduler->balance(g_core_infos, g_reactor_count);
|
||||
|
||||
g_scheduler_core_number = spdk_env_get_first_core();
|
||||
_reactors_scheduler_update_core_mode(NULL);
|
||||
}
|
||||
|
||||
/* Phase 1 of thread scheduling is to gather metrics on the existing threads */
|
||||
|
Loading…
Reference in New Issue
Block a user