Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/54963/?format=api
http://patches.dpdk.org/api/patches/54963/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1560957293-17294-9-git-send-email-ndragazis@arrikto.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1560957293-17294-9-git-send-email-ndragazis@arrikto.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1560957293-17294-9-git-send-email-ndragazis@arrikto.com", "date": "2019-06-19T15:14:33", "name": "[08/28] vhost: move vhost-user fdset", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": true, "hash": "e13a36da33a03bb632efedce8c44f11bc47997f4", "submitter": { "id": 1339, "url": "http://patches.dpdk.org/api/people/1339/?format=api", "name": "Nikos Dragazis", "email": "ndragazis@arrikto.com" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1560957293-17294-9-git-send-email-ndragazis@arrikto.com/mbox/", "series": [ { "id": 5082, "url": "http://patches.dpdk.org/api/series/5082/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5082", "date": "2019-06-19T15:14:25", "name": "vhost: add virtio-vhost-user transport", "version": 1, "mbox": "http://patches.dpdk.org/series/5082/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/54963/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/54963/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C6D401C3CC;\n\tWed, 19 Jun 2019 17:16:01 +0200 (CEST)", "from mx0.arrikto.com (mx0.arrikto.com [212.71.252.59])\n\tby dpdk.org (Postfix) with ESMTP id A08101C389\n\tfor <dev@dpdk.org>; Wed, 19 Jun 2019 17:15:39 +0200 (CEST)", "from troi.prod.arr (mail.arr [10.99.0.5])\n\tby mx0.arrikto.com (Postfix) with ESMTP id 3160B18200D;\n\tWed, 19 Jun 2019 18:15:39 +0300 (EEST)", "from localhost.localdomain (unknown [10.89.50.133])\n\tby troi.prod.arr (Postfix) with ESMTPSA id 97C9C32C;\n\tWed, 19 Jun 2019 18:15:38 +0300 (EEST)" ], "From": "Nikos Dragazis <ndragazis@arrikto.com>", "To": "dev@dpdk.org", "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n\tTiwei Bie <tiwei.bie@intel.com>, Zhihong Wang <zhihong.wang@intel.com>,\n\tStefan Hajnoczi <stefanha@redhat.com>, Wei Wang <wei.w.wang@intel.com>,\n\tStojaczyk Dariusz <dariusz.stojaczyk@intel.com>,\n\tVangelis Koukis <vkoukis@arrikto.com>", "Date": "Wed, 19 Jun 2019 18:14:33 +0300", "Message-Id": "<1560957293-17294-9-git-send-email-ndragazis@arrikto.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1560957293-17294-1-git-send-email-ndragazis@arrikto.com>", "References": "<1560957293-17294-1-git-send-email-ndragazis@arrikto.com>", "Subject": "[dpdk-dev] [PATCH 08/28] vhost: move vhost-user fdset", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "The fdset is used by the AF_UNIX transport code but other transports may\nnot need it. Move it to trans_af_unix.c and then make struct vhost_user\nprivate again since nothing outside socket.c needs it.\n\nSigned-off-by: Nikos Dragazis <ndragazis@arrikto.com>\nSigned-off-by: Stefan Hajnoczi <stefanha@redhat.com>\n---\n lib/librte_vhost/socket.c | 37 +++++++---------------------------\n lib/librte_vhost/trans_af_unix.c | 43 +++++++++++++++++++++++++++++++++++-----\n lib/librte_vhost/vhost.h | 15 --------------\n 3 files changed, 45 insertions(+), 50 deletions(-)", "diff": "diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c\nindex 373c01d..fc78b63 100644\n--- a/lib/librte_vhost/socket.c\n+++ b/lib/librte_vhost/socket.c\n@@ -16,13 +16,14 @@\n #include \"vhost.h\"\n #include \"vhost_user.h\"\n \n+#define MAX_VHOST_SOCKET 1024\n+struct vhost_user {\n+\tstruct vhost_user_socket *vsockets[MAX_VHOST_SOCKET];\n+\tint vsocket_cnt;\n+\tpthread_mutex_t mutex;\n+};\n+\n struct vhost_user vhost_user = {\n-\t.fdset = {\n-\t\t.fd = { [0 ... MAX_FDS - 1] = {-1, NULL, NULL, NULL, 0} },\n-\t\t.fd_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.fd_pooling_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.num = 0\n-\t},\n \t.vsocket_cnt = 0,\n \t.mutex = PTHREAD_MUTEX_INITIALIZER,\n };\n@@ -484,7 +485,6 @@ int\n rte_vhost_driver_start(const char *path)\n {\n \tstruct vhost_user_socket *vsocket;\n-\tstatic pthread_t fdset_tid;\n \n \tpthread_mutex_lock(&vhost_user.mutex);\n \tvsocket = find_vhost_user_socket(path);\n@@ -493,28 +493,5 @@ rte_vhost_driver_start(const char *path)\n \tif (!vsocket)\n \t\treturn -1;\n \n-\tif (fdset_tid == 0) {\n-\t\t/**\n-\t\t * create a pipe which will be waited by poll and notified to\n-\t\t * rebuild the wait list of poll.\n-\t\t */\n-\t\tif (fdset_pipe_init(&vhost_user.fdset) < 0) {\n-\t\t\tRTE_LOG(ERR, VHOST_CONFIG,\n-\t\t\t\t\"failed to create pipe for vhost fdset\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\n-\t\tint ret = rte_ctrl_thread_create(&fdset_tid,\n-\t\t\t\"vhost-events\", NULL, fdset_event_dispatch,\n-\t\t\t&vhost_user.fdset);\n-\t\tif (ret != 0) {\n-\t\t\tRTE_LOG(ERR, VHOST_CONFIG,\n-\t\t\t\t\"failed to create fdset handling thread\");\n-\n-\t\t\tfdset_pipe_uninit(&vhost_user.fdset);\n-\t\t\treturn -1;\n-\t\t}\n-\t}\n-\n \treturn vsocket->trans_ops->socket_start(vsocket);\n }\ndiff --git a/lib/librte_vhost/trans_af_unix.c b/lib/librte_vhost/trans_af_unix.c\nindex 00d5366..e8a4ef2 100644\n--- a/lib/librte_vhost/trans_af_unix.c\n+++ b/lib/librte_vhost/trans_af_unix.c\n@@ -10,11 +10,19 @@\n \n #include <rte_log.h>\n \n+#include \"fd_man.h\"\n #include \"vhost.h\"\n #include \"vhost_user.h\"\n \n #define MAX_VIRTIO_BACKLOG 128\n \n+static struct fdset af_unix_fdset = {\n+\t.fd = { [0 ... MAX_FDS - 1] = {-1, NULL, NULL, NULL, 0} },\n+\t.fd_mutex = PTHREAD_MUTEX_INITIALIZER,\n+\t.fd_pooling_mutex = PTHREAD_MUTEX_INITIALIZER,\n+\t.num = 0\n+};\n+\n TAILQ_HEAD(vhost_user_connection_list, vhost_user_connection);\n \n struct vhost_user_connection {\n@@ -189,7 +197,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)\n \tconn->connfd = fd;\n \tconn->vsocket = vsocket;\n \tconn->vid = vid;\n-\tret = fdset_add(&vhost_user.fdset, fd, vhost_user_read_cb,\n+\tret = fdset_add(&af_unix_fdset, fd, vhost_user_read_cb,\n \t\t\tNULL, conn);\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG,\n@@ -206,7 +214,7 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)\n \tTAILQ_INSERT_TAIL(&af_vsocket->conn_list, conn, next);\n \tpthread_mutex_unlock(&af_vsocket->conn_mutex);\n \n-\tfdset_pipe_notify(&vhost_user.fdset);\n+\tfdset_pipe_notify(&af_unix_fdset);\n \treturn;\n \n err_cleanup:\n@@ -330,7 +338,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket)\n \tif (ret < 0)\n \t\tgoto err;\n \n-\tret = fdset_add(&vhost_user.fdset, fd, vhost_user_server_new_connection,\n+\tret = fdset_add(&af_unix_fdset, fd, vhost_user_server_new_connection,\n \t\t NULL, vsocket);\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG,\n@@ -556,7 +564,7 @@ af_unix_socket_cleanup(struct vhost_user_socket *vsocket)\n \tstruct vhost_user_connection *conn, *next;\n \n \tif (vsocket->is_server) {\n-\t\tfdset_del(&vhost_user.fdset, af_vsocket->socket_fd);\n+\t\tfdset_del(&af_unix_fdset, af_vsocket->socket_fd);\n \t\tclose(af_vsocket->socket_fd);\n \t\tunlink(vsocket->path);\n \t} else if (vsocket->reconnect) {\n@@ -575,7 +583,7 @@ af_unix_socket_cleanup(struct vhost_user_socket *vsocket)\n \t\t * conn_mutex lock, and try again since\n \t\t * the r/wcb may use the conn_mutex lock.\n \t\t */\n-\t\tif (fdset_try_del(&vhost_user.fdset,\n+\t\tif (fdset_try_del(&af_unix_fdset,\n \t\t\t\t conn->connfd) == -1) {\n \t\t\tpthread_mutex_unlock(\n \t\t\t\t\t&af_vsocket->conn_mutex);\n@@ -598,6 +606,31 @@ af_unix_socket_cleanup(struct vhost_user_socket *vsocket)\n static int\n af_unix_socket_start(struct vhost_user_socket *vsocket)\n {\n+\tstatic pthread_t fdset_tid;\n+\n+\tif (fdset_tid == 0) {\n+\t\t/**\n+\t\t * create a pipe which will be waited by poll and notified to\n+\t\t * rebuild the wait list of poll.\n+\t\t */\n+\t\tif (fdset_pipe_init(&af_unix_fdset) < 0) {\n+\t\t\tRTE_LOG(ERR, VHOST_CONFIG,\n+\t\t\t\t\"failed to create pipe for vhost fdset\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tint ret = rte_ctrl_thread_create(&fdset_tid,\n+\t\t\t\"vhost-events\", NULL, fdset_event_dispatch,\n+\t\t\t&af_unix_fdset);\n+\t\tif (ret != 0) {\n+\t\t\tRTE_LOG(ERR, VHOST_CONFIG,\n+\t\t\t\t\"failed to create fdset handling thread\");\n+\n+\t\t\tfdset_pipe_uninit(&af_unix_fdset);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n \tif (vsocket->is_server)\n \t\treturn vhost_user_start_server(vsocket);\n \telse\ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex d8b5ec2..64b7f77 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -22,7 +22,6 @@\n #include <rte_rwlock.h>\n #include <rte_malloc.h>\n \n-#include \"fd_man.h\"\n #include \"rte_vhost.h\"\n #include \"rte_vdpa.h\"\n \n@@ -404,10 +403,6 @@ struct virtio_net {\n \tstruct rte_vhost_user_extern_ops extern_ops;\n } __rte_cache_aligned;\n \n-/* The vhost_user and vhost_user_socket declarations are temporary measures for\n- * moving AF_UNIX code into trans_af_unix.c. They will be cleaned up as\n- * socket.c is untangled from trans_af_unix.c.\n- */\n /*\n * Every time rte_vhost_driver_register() is invoked, an associated\n * vhost_user_socket struct will be created.\n@@ -448,16 +443,6 @@ struct vhost_user_socket {\n \tstruct vhost_transport_ops const *trans_ops;\n };\n \n-#define MAX_VHOST_SOCKET 1024\n-struct vhost_user {\n-\tstruct vhost_user_socket *vsockets[MAX_VHOST_SOCKET];\n-\tstruct fdset fdset;\n-\tint vsocket_cnt;\n-\tpthread_mutex_t mutex;\n-};\n-\n-extern struct vhost_user vhost_user;\n-\n static __rte_always_inline bool\n vq_is_packed(struct virtio_net *dev)\n {\n", "prefixes": [ "08/28" ] }{ "id": 54963, "url": "