Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/77290/?format=api
http://patches.dpdk.org/api/patches/77290/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200911015316.1903181-3-patrick.fu@intel.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": "<20200911015316.1903181-3-patrick.fu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200911015316.1903181-3-patrick.fu@intel.com", "date": "2020-09-11T01:53:14", "name": "[v1,2/4] vhost: dynamically alloc async memory", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e296b138ab6d34a0653fc3aedb6a31a9a758fa2b", "submitter": { "id": 1781, "url": "http://patches.dpdk.org/api/people/1781/?format=api", "name": "Patrick Fu", "email": "patrick.fu@intel.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/20200911015316.1903181-3-patrick.fu@intel.com/mbox/", "series": [ { "id": 12117, "url": "http://patches.dpdk.org/api/series/12117/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12117", "date": "2020-09-11T01:53:12", "name": "optimize async data path", "version": 1, "mbox": "http://patches.dpdk.org/series/12117/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/77290/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/77290/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 133F5A04B5;\n\tFri, 11 Sep 2020 04:01:06 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8F4731C1B2;\n\tFri, 11 Sep 2020 03:59:36 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by dpdk.org (Postfix) with ESMTP id F28811C0D7\n for <dev@dpdk.org>; Fri, 11 Sep 2020 03:59:34 +0200 (CEST)", "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2020 18:59:34 -0700", "from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92])\n by orsmga002.jf.intel.com with ESMTP; 10 Sep 2020 18:59:31 -0700" ], "IronPort-SDR": [ "\n /S04120lqNQdLYTQCTUj7ZcOOYOhrBWiOfWXUGnskyasodrFGkMYbEMQcNY26pzh2Zcs9YiY1b\n 4q74W1i26ZVA==", "\n ssSu8mduS1qmUWbY20SRlS5XXj0vlHAcMzx2sWDv163Y3hWKgnFTYEwRjZI7+MIp/zRGgaN0Q1\n sCv6vW14j6qg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9740\"; a=\"156072285\"", "E=Sophos;i=\"5.76,413,1592895600\"; d=\"scan'208\";a=\"156072285\"", "E=Sophos;i=\"5.76,413,1592895600\"; d=\"scan'208\";a=\"318121869\"" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "From": "Patrick Fu <patrick.fu@intel.com>", "To": "dev@dpdk.org,\n\tmaxime.coquelin@redhat.com,\n\tchenbo.xia@intel.com", "Cc": "zhihong.wang@intel.com,\n\tcheng1.jiang@intel.com,\n\tpatrick.fu@intel.com", "Date": "Fri, 11 Sep 2020 09:53:14 +0800", "Message-Id": "<20200911015316.1903181-3-patrick.fu@intel.com>", "X-Mailer": "git-send-email 2.18.4", "In-Reply-To": "<20200911015316.1903181-1-patrick.fu@intel.com>", "References": "<20200911015316.1903181-1-patrick.fu@intel.com>", "Subject": "[dpdk-dev] [PATCH v1 2/4] vhost: dynamically alloc async memory", "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "alloc async internal memory buffer by rte_malloc(), replacing array\ndeclaration inside vq structure. Dynamic allocation can help to save\nmemory footprint when async path is not registered.\n\nSigned-off-by: Patrick Fu <patrick.fu@intel.com>\n---\n lib/librte_vhost/vhost.c | 49 ++++++++++++++++++++++++----------------\n lib/librte_vhost/vhost.h | 4 ++--\n 2 files changed, 31 insertions(+), 22 deletions(-)", "diff": "diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex eca507836..ba374da67 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -324,6 +324,24 @@ cleanup_device(struct virtio_net *dev, int destroy)\n \t}\n }\n \n+static void\n+vhost_free_async_mem(struct vhost_virtqueue *vq)\n+{\n+\tif (vq->async_pkts_pending)\n+\t\trte_free(vq->async_pkts_pending);\n+\tif (vq->async_pkts_info)\n+\t\trte_free(vq->async_pkts_info);\n+\tif (vq->it_pool)\n+\t\trte_free(vq->it_pool);\n+\tif (vq->vec_pool)\n+\t\trte_free(vq->vec_pool);\n+\n+\tvq->async_pkts_pending = NULL;\n+\tvq->async_pkts_info = NULL;\n+\tvq->it_pool = NULL;\n+\tvq->vec_pool = NULL;\n+}\n+\n void\n free_vq(struct virtio_net *dev, struct vhost_virtqueue *vq)\n {\n@@ -331,10 +349,7 @@ free_vq(struct virtio_net *dev, struct vhost_virtqueue *vq)\n \t\trte_free(vq->shadow_used_packed);\n \telse {\n \t\trte_free(vq->shadow_used_split);\n-\t\tif (vq->async_pkts_pending)\n-\t\t\trte_free(vq->async_pkts_pending);\n-\t\tif (vq->async_pkts_info)\n-\t\t\trte_free(vq->async_pkts_info);\n+\t\tvhost_free_async_mem(vq);\n \t}\n \trte_free(vq->batch_copy_elems);\n \trte_mempool_free(vq->iotlb_pool);\n@@ -1576,13 +1591,15 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n \tvq->async_pkts_info = rte_malloc(NULL,\n \t\t\tvq->size * sizeof(struct async_inflight_info),\n \t\t\tRTE_CACHE_LINE_SIZE);\n-\tif (!vq->async_pkts_pending || !vq->async_pkts_info) {\n-\t\tif (vq->async_pkts_pending)\n-\t\t\trte_free(vq->async_pkts_pending);\n-\n-\t\tif (vq->async_pkts_info)\n-\t\t\trte_free(vq->async_pkts_info);\n-\n+\tvq->it_pool = rte_malloc(NULL,\n+\t\t\tVHOST_MAX_ASYNC_IT * sizeof(struct rte_vhost_iov_iter),\n+\t\t\tRTE_CACHE_LINE_SIZE);\n+\tvq->vec_pool = rte_malloc(NULL,\n+\t\t\tVHOST_MAX_ASYNC_VEC * sizeof(struct iovec),\n+\t\t\tRTE_CACHE_LINE_SIZE);\n+\tif (!vq->async_pkts_pending || !vq->async_pkts_info ||\n+\t\t!vq->it_pool || !vq->vec_pool) {\n+\t\tvhost_free_async_mem(vq);\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\t\"async register failed: cannot allocate memory for vq data \"\n \t\t\t\t\"(vid %d, qid: %d)\\n\", vid, queue_id);\n@@ -1630,15 +1647,7 @@ int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)\n \t\tgoto out;\n \t}\n \n-\tif (vq->async_pkts_pending) {\n-\t\trte_free(vq->async_pkts_pending);\n-\t\tvq->async_pkts_pending = NULL;\n-\t}\n-\n-\tif (vq->async_pkts_info) {\n-\t\trte_free(vq->async_pkts_info);\n-\t\tvq->async_pkts_info = NULL;\n-\t}\n+\tvhost_free_async_mem(vq);\n \n \tvq->async_ops.transfer_data = NULL;\n \tvq->async_ops.check_completed_copies = NULL;\ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 28aa77380..0af0ac23d 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -218,8 +218,8 @@ struct vhost_virtqueue {\n \t/* operation callbacks for async dma */\n \tstruct rte_vhost_async_channel_ops\tasync_ops;\n \n-\tstruct rte_vhost_iov_iter it_pool[VHOST_MAX_ASYNC_IT];\n-\tstruct iovec vec_pool[VHOST_MAX_ASYNC_VEC];\n+\tstruct rte_vhost_iov_iter *it_pool;\n+\tstruct iovec *vec_pool;\n \n \t/* async data transfer status */\n \tuintptr_t\t**async_pkts_pending;\n", "prefixes": [ "v1", "2/4" ] }{ "id": 77290, "url": "