lib/vhost: move vhost_user init thread tracking
Keep track of g_vhost_user_init_thread, local to the rte_vhost_user.c. There is no need to track this in generic vhost layer. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I1fd22e196a3091284f5f9c3c0c7c70a0e18514cb Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11075 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: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
d7cd645c9f
commit
b514849ca1
@ -49,6 +49,8 @@
|
|||||||
/* Path to folder where character device will be created. Can be set by user. */
|
/* Path to folder where character device will be created. Can be set by user. */
|
||||||
static char g_vhost_user_dev_dirname[PATH_MAX] = "";
|
static char g_vhost_user_dev_dirname[PATH_MAX] = "";
|
||||||
|
|
||||||
|
static struct spdk_thread *g_vhost_user_init_thread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DPDK calls our callbacks synchronously but the work those callbacks
|
* DPDK calls our callbacks synchronously but the work those callbacks
|
||||||
* perform needs to be async. Luckily, all DPDK callbacks are called on
|
* perform needs to be async. Luckily, all DPDK callbacks are called on
|
||||||
@ -618,7 +620,7 @@ foreach_session(void *arg1)
|
|||||||
out:
|
out:
|
||||||
spdk_vhost_unlock();
|
spdk_vhost_unlock();
|
||||||
|
|
||||||
spdk_thread_send_msg(g_vhost_init_thread, foreach_session_finish_cb, arg1);
|
spdk_thread_send_msg(g_vhost_user_init_thread, foreach_session_finish_cb, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1120,6 +1122,9 @@ vhost_user_init(void)
|
|||||||
|
|
||||||
g_vhost_user_started = true;
|
g_vhost_user_started = true;
|
||||||
|
|
||||||
|
g_vhost_user_init_thread = spdk_get_thread();
|
||||||
|
assert(g_vhost_user_init_thread != NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,7 +1149,7 @@ vhost_user_session_shutdown(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SPDK_INFOLOG(vhost, "Exiting\n");
|
SPDK_INFOLOG(vhost, "Exiting\n");
|
||||||
spdk_thread_send_msg(g_vhost_init_thread, vhost_cb, NULL);
|
spdk_thread_send_msg(g_vhost_user_init_thread, vhost_cb, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +46,6 @@ bool g_packed_ring_recovery = false;
|
|||||||
|
|
||||||
static struct spdk_cpuset g_vhost_core_mask;
|
static struct spdk_cpuset g_vhost_core_mask;
|
||||||
|
|
||||||
/* Thread performing all vhost management operations */
|
|
||||||
struct spdk_thread *g_vhost_init_thread = NULL;
|
|
||||||
|
|
||||||
static TAILQ_HEAD(, spdk_vhost_dev) g_vhost_devices = TAILQ_HEAD_INITIALIZER(
|
static TAILQ_HEAD(, spdk_vhost_dev) g_vhost_devices = TAILQ_HEAD_INITIALIZER(
|
||||||
g_vhost_devices);
|
g_vhost_devices);
|
||||||
static pthread_mutex_t g_vhost_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t g_vhost_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
@ -908,9 +905,6 @@ spdk_vhost_init(spdk_vhost_init_cb init_cb)
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
g_vhost_init_thread = spdk_get_thread();
|
|
||||||
assert(g_vhost_init_thread != NULL);
|
|
||||||
|
|
||||||
ret = vhost_user_init();
|
ret = vhost_user_init();
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
init_cb(ret);
|
init_cb(ret);
|
||||||
@ -947,8 +941,6 @@ vhost_fini(void *arg1)
|
|||||||
void
|
void
|
||||||
spdk_vhost_fini(spdk_vhost_fini_cb fini_cb)
|
spdk_vhost_fini(spdk_vhost_fini_cb fini_cb)
|
||||||
{
|
{
|
||||||
assert(spdk_get_thread() == g_vhost_init_thread);
|
|
||||||
|
|
||||||
g_fini_cb = fini_cb;
|
g_fini_cb = fini_cb;
|
||||||
|
|
||||||
vhost_user_fini(vhost_fini);
|
vhost_user_fini(vhost_fini);
|
||||||
|
@ -47,9 +47,6 @@
|
|||||||
|
|
||||||
extern bool g_packed_ring_recovery;
|
extern bool g_packed_ring_recovery;
|
||||||
|
|
||||||
/* Thread performing all vhost management operations */
|
|
||||||
extern struct spdk_thread *g_vhost_init_thread;
|
|
||||||
|
|
||||||
#define SPDK_VHOST_MAX_VQUEUES 256
|
#define SPDK_VHOST_MAX_VQUEUES 256
|
||||||
#define SPDK_VHOST_MAX_VQ_SIZE 1024
|
#define SPDK_VHOST_MAX_VQ_SIZE 1024
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user