Commit e5d7a445 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

vhost: introduce session names



We currently don't have any way to differentiate different
sessions e.g. in error messages. Whenever there's an error
in some session, we just print the device name.

We now introduce vsession->name with the following format:
<device name>s<dpdk connection id>

Note that it's still impossible to know exactly which
qemu process corresponds to which session in spdk, but
there's not much we could do in that matter right now.
In spdk we don't even have the accepted connection fd.

Change-Id: I666aa60c5e36bf3d56f68133042af2afc8cc5e85
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466039


Reviewed-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 0ce883ce
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1373,8 +1373,15 @@ new_connection(int vid)
	memset(vsession, 0, sizeof(*vsession) + vdev->backend->session_ctx_size);

	vsession->vdev = vdev;
	vsession->id = vdev->vsessions_num++;
	vsession->vid = vid;
	vsession->id = vdev->vsessions_num++;
	vsession->name = spdk_sprintf_alloc("%ss%u", vdev->name, vsession->vid);
	if (vsession->name == NULL) {
		SPDK_ERRLOG("vsession alloc failed\n");
		pthread_mutex_unlock(&g_spdk_vhost_mutex);
		free(vsession);
		return -1;
	}
	vsession->poll_group = NULL;
	vsession->started = false;
	vsession->initialized = false;
@@ -1406,6 +1413,7 @@ destroy_connection(int vid)
	}

	TAILQ_REMOVE(&vsession->vdev->vsessions, vsession, tailq);
	free(vsession->name);
	free(vsession);
	pthread_mutex_unlock(&g_spdk_vhost_mutex);
}
+2 −0
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ struct spdk_vhost_session {

	/* Unique session ID. */
	uint64_t id;
	/* Unique session name. */
	char *name;

	struct vhost_poll_group *poll_group;