vhost: allocate session_shutdown as spdk_event instead of pthread
This change allows for spdk_app_stop() to be executed on a DPDK lcore instead outside of DPDK lcore range. This is preparation for SPDK asynchronous finish, to assure calling spdk_app_stop() from master core. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: Iedc878346c74296b105f93507b2c858aedfbf16e Reviewed-on: https://review.gerrithub.io/381535 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Maciej Szwed <maciej.szwed@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
2317eedd0a
commit
ba8515c61c
@ -810,6 +810,12 @@ spdk_vhost_startup(void *arg1, void *arg2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
session_app_stop(void *arg1, void *arg2)
|
||||||
|
{
|
||||||
|
spdk_app_stop(0);
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
session_shutdown(void *arg)
|
session_shutdown(void *arg)
|
||||||
{
|
{
|
||||||
@ -834,7 +840,7 @@ session_shutdown(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SPDK_NOTICELOG("Exiting\n");
|
SPDK_NOTICELOG("Exiting\n");
|
||||||
spdk_app_stop(0);
|
spdk_event_call((struct spdk_event *)arg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,8 +852,11 @@ spdk_vhost_shutdown_cb(void)
|
|||||||
{
|
{
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
struct spdk_event *vhost_app_stop;
|
||||||
|
|
||||||
if (pthread_create(&tid, NULL, &session_shutdown, NULL) < 0) {
|
vhost_app_stop = spdk_event_allocate(spdk_env_get_current_core(), session_app_stop, NULL, NULL);
|
||||||
|
|
||||||
|
if (pthread_create(&tid, NULL, &session_shutdown, vhost_app_stop) < 0) {
|
||||||
spdk_strerror_r(errno, buf, sizeof(buf));
|
spdk_strerror_r(errno, buf, sizeof(buf));
|
||||||
SPDK_ERRLOG("Failed to start session shutdown thread (%d): %s\n", errno, buf);
|
SPDK_ERRLOG("Failed to start session shutdown thread (%d): %s\n", errno, buf);
|
||||||
abort();
|
abort();
|
||||||
|
Loading…
Reference in New Issue
Block a user