examples/accel_perf: fail correctly when we can't get a channel

By design there is a limit to how many channels the idxd driver
can suport based on how many DSA instances are available.  When we
reach the limit we won't be able to get a channel.  This fixes that
error path to fail gracefully instead of seg faulting.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I226f59913cb830eae0707623ae251ba19bce9aaf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12218
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
paul luse 2022-04-11 12:45:34 -07:00 committed by Jim Harris
parent 81d3cc1b5a
commit 2dd64cf962

View File

@ -701,6 +701,10 @@ _init_thread(void *arg1)
g_workers = worker;
pthread_mutex_unlock(&g_workers_lock);
worker->ch = spdk_accel_engine_get_io_channel();
if (worker->ch == NULL) {
fprintf(stderr, "Unable to get an accel channel\n");
goto error;
}
TAILQ_INIT(&worker->tasks_pool);
@ -757,7 +761,6 @@ error:
free(worker->rnd_data);
_free_task_buffers_in_pool(worker);
free(worker->task_base);
free(worker);
spdk_app_stop(-1);
}