event: add an assert check for obtained reactor

In the case that reactor is needed to be valid, add an
explicit assert there.

Change-Id: Ic47030d50a6a940ddf87a3744bae38c94dd7252e
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7320
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
GangCao 2021-04-12 17:34:51 -04:00 committed by Jim Harris
parent 567a3da8ca
commit ebeac5decc

View File

@ -353,6 +353,7 @@ _reactor_set_notify_cpuset(void *arg1, void *arg2)
struct spdk_reactor *target = arg1; struct spdk_reactor *target = arg1;
struct spdk_reactor *reactor = spdk_reactor_get(spdk_env_get_current_core()); struct spdk_reactor *reactor = spdk_reactor_get(spdk_env_get_current_core());
assert(reactor != NULL);
spdk_cpuset_set_cpu(&reactor->notify_cpuset, target->lcore, target->new_in_interrupt); spdk_cpuset_set_cpu(&reactor->notify_cpuset, target->lcore, target->new_in_interrupt);
} }
@ -715,6 +716,7 @@ _reactors_scheduler_update_core_mode(void *ctx)
} }
reactor = spdk_reactor_get(g_scheduler_core_number); reactor = spdk_reactor_get(g_scheduler_core_number);
assert(reactor != NULL);
if (reactor->in_interrupt != g_core_infos[g_scheduler_core_number].interrupt_mode) { if (reactor->in_interrupt != g_core_infos[g_scheduler_core_number].interrupt_mode) {
/* Switch next found reactor to new state */ /* Switch next found reactor to new state */
rc = spdk_reactor_set_interrupt_mode(g_scheduler_core_number, rc = spdk_reactor_set_interrupt_mode(g_scheduler_core_number,
@ -1078,6 +1080,8 @@ thread_process_interrupts(void *arg)
uint64_t now; uint64_t now;
int rc; int rc;
assert(reactor != NULL);
/* Update idle_tsc between the end of last intr_fn and the start of this intr_fn. */ /* Update idle_tsc between the end of last intr_fn and the start of this intr_fn. */
now = spdk_get_ticks(); now = spdk_get_ticks();
reactor->idle_tsc += now - reactor->tsc_last; reactor->idle_tsc += now - reactor->tsc_last;