From 1234a3e52a069ceeabc975e74870e9cb5164fd18 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Mon, 29 Apr 2019 09:28:23 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452395 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/vhost/vhost.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 5a71308a4..408a45a1f 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -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);