vhost: set lcore from the DPDK thread
Now that sessions have a separate flag to check if the pollers are started, we can set the lcore field on any thread we want. We currently assign it from within the session thread to spdk_env_get_current_core(), but we won't be able to use an equivalent get_current_poll_group() function after we switch to poll groups. We will only have a poll group object inside spdk_vhost_session_send_event(), so that's where we move the lcore assignment for now. Change-Id: Ib5fb37ec488de80e9d79432120c81500c297b608 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452395 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
376d893a20
commit
1234a3e52a
@ -898,7 +898,6 @@ void
|
||||
spdk_vhost_session_start_done(struct spdk_vhost_session *vsession, int response)
|
||||
{
|
||||
if (response == 0) {
|
||||
vsession->lcore = spdk_env_get_current_core();
|
||||
vsession->started = true;
|
||||
assert(vsession->vdev->active_session_num < UINT32_MAX);
|
||||
vsession->vdev->active_session_num++;
|
||||
@ -910,7 +909,6 @@ void
|
||||
spdk_vhost_session_stop_done(struct spdk_vhost_session *vsession, int response)
|
||||
{
|
||||
if (response == 0) {
|
||||
vsession->lcore = -1;
|
||||
vsession->started = false;
|
||||
assert(vsession->vdev->active_session_num > 0);
|
||||
vsession->vdev->active_session_num--;
|
||||
@ -1012,6 +1010,7 @@ spdk_vhost_session_send_event(int32_t lcore, struct spdk_vhost_session *vsession
|
||||
ev_ctx.vsession_id = vsession->id;
|
||||
ev_ctx.cb_fn = cb_fn;
|
||||
|
||||
vsession->lcore = lcore;
|
||||
vsession->event_ctx = &ev_ctx;
|
||||
ev = spdk_event_allocate(lcore, spdk_vhost_event_cb, &ev_ctx, NULL);
|
||||
assert(ev);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user