Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/118253/?format=api
http://patches.dpdk.org/api/patches/118253/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221017074817.28889-1-changpeng.liu@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": "<20221017074817.28889-1-changpeng.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221017074817.28889-1-changpeng.liu@intel.com", "date": "2022-10-17T07:48:17", "name": "[v4] vhost: add new `rte_vhost_vring_call_nonblock` API", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "7a5b52d5e8fc10d3836e2ca11286d062f6ef8050", "submitter": { "id": 565, "url": "http://patches.dpdk.org/api/people/565/?format=api", "name": "Liu, Changpeng", "email": "changpeng.liu@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/20221017074817.28889-1-changpeng.liu@intel.com/mbox/", "series": [ { "id": 25250, "url": "http://patches.dpdk.org/api/series/25250/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25250", "date": "2022-10-17T07:48:17", "name": "[v4] vhost: add new `rte_vhost_vring_call_nonblock` API", "version": 4, "mbox": "http://patches.dpdk.org/series/25250/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/118253/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/118253/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 7DB9AA0556;\n\tMon, 17 Oct 2022 09:48:33 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 726B040143;\n\tMon, 17 Oct 2022 09:48:33 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id 1FF09400D7\n for <dev@dpdk.org>; Mon, 17 Oct 2022 09:48:31 +0200 (CEST)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Oct 2022 00:48:28 -0700", "from waikikibeach52.sh.intel.com ([10.67.111.175])\n by fmsmga005.fm.intel.com with ESMTP; 17 Oct 2022 00:48:27 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1665992912; x=1697528912;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=ZL1qhD/kTeb+yIlDssenUCpCl8kedv8SxlFamjaiKMY=;\n b=mcP5EcBRzC9b09LpMclq7qGcpBxESogzYK1aHvH4Fv0dOhEdwl9w8D39\n X6sUL2b2xeajs3V3BxrYy1+WcxNEqUGKMk6EfNkdaI0wC60/qk6o+fxYl\n FyMr6e+QWob20PUp5w+ocTzgHgzcYSYCJ2YQFdZkDcdD70PJH7UXExOO2\n gsrS6IpfTTG8nI2dhzDsw6buSMO2eLCdFKsy0u5WZLHAbfQKh2cvcZdWJ\n FgqlwvUpfSyt2I2qg5QGjO7+/jgOc8ViHFVaJOy6tfZWOTDVJNmlH6ve8\n 5z9/iQ+2wNzDOeaZVeraDC5QCCYDdqh1m4/Rh1qkMyXe/akppgrCjdFcE A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6500,9779,10502\"; a=\"293098836\"", "E=Sophos;i=\"5.95,190,1661842800\"; d=\"scan'208\";a=\"293098836\"", "E=McAfee;i=\"6500,9779,10502\"; a=\"957244317\"", "E=Sophos;i=\"5.95,190,1661842800\"; d=\"scan'208\";a=\"957244317\"" ], "X-ExtLoop1": "1", "From": "Changpeng Liu <changpeng.liu@intel.com>", "To": "dev@dpdk.org", "Cc": "Changpeng Liu <changpeng.liu@intel.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>,\n David Marchand <david.marchand@redhat.com>", "Subject": "[PATCH v4] vhost: add new `rte_vhost_vring_call_nonblock` API", "Date": "Mon, 17 Oct 2022 15:48:17 +0800", "Message-Id": "<20221017074817.28889-1-changpeng.liu@intel.com>", "X-Mailer": "git-send-email 2.21.3", "In-Reply-To": "<20221017071457.28589-1-changpeng.liu@intel.com>", "References": "<20221017071457.28589-1-changpeng.liu@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "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" }, "content": "Vhost-user library locks all VQ's access lock when processing\nvring based messages, such as SET_VRING_KICK and SET_VRING_CALL,\nand the data processing thread may already be started, e.g: SPDK\nvhost-blk and vhost-scsi will start the data processing thread\nwhen one vring is ready, then deadlock may happen when SPDK is\nposting interrupts to VM. Here, we add a new API which allows\ncaller to try again later for this case.\n\nBugzilla ID: 1015\nFixes: c5736998305d (\"vhost: fix missing virtqueue lock protection\")\n\nSigned-off-by: Changpeng Liu <changpeng.liu@intel.com>\n---\n doc/guides/prog_guide/vhost_lib.rst | 6 ++++++\n doc/guides/rel_notes/release_22_11.rst | 6 ++++++\n lib/vhost/rte_vhost.h | 15 +++++++++++++\n lib/vhost/version.map | 3 +++\n lib/vhost/vhost.c | 30 ++++++++++++++++++++++++++\n 5 files changed, 60 insertions(+)", "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex bad4d819e1..52f0589f51 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -297,6 +297,12 @@ The following is an overview of some key Vhost API functions:\n Clear in-flight packets which are submitted to async channel in vhost async data\n path. Completed packets are returned to applications through ``pkts``.\n \n+* ``rte_vhost_vring_call_nonblock(int vid, uint16_t vring_idx)``\n+\n+ Notify the guest that used descriptors have been added to the vring. This function\n+ will return -EAGAIN when vq's access lock is held by other thread, user should try\n+ again later.\n+\n * ``rte_vhost_vring_stats_get_names(int vid, uint16_t queue_id, struct rte_vhost_stat_name *names, unsigned int size)``\n \n This function returns the names of the queue statistics. It requires\ndiff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst\nindex 2da8bc9661..b3d1ba043c 100644\n--- a/doc/guides/rel_notes/release_22_11.rst\n+++ b/doc/guides/rel_notes/release_22_11.rst\n@@ -225,6 +225,12 @@ New Features\n sysfs entries to adjust the minimum and maximum uncore frequency values,\n which works on Linux with Intel hardware only.\n \n+* **Added non-blocking notify API to the vhost library.**\n+\n+ Added ``rte_vhost_vring_call_nonblock`` API to notify the guest that\n+ used descriptors have been added to the vring in non-blocking way. User\n+ should check the return value of this API and try again if needed.\n+\n * **Rewritten pmdinfo script.**\n \n The ``dpdk-pmdinfo.py`` script was rewritten to produce valid JSON only.\ndiff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h\nindex bb7d86a432..d22b25cd4e 100644\n--- a/lib/vhost/rte_vhost.h\n+++ b/lib/vhost/rte_vhost.h\n@@ -909,6 +909,21 @@ rte_vhost_clr_inflight_desc_packed(int vid, uint16_t vring_idx,\n */\n int rte_vhost_vring_call(int vid, uint16_t vring_idx);\n \n+/**\n+ * Notify the guest that used descriptors have been added to the vring. This\n+ * function acts as a memory barrier. This function will return -EAGAIN when\n+ * vq's access lock is held by other thread, user should try again later.\n+ *\n+ * @param vid\n+ * vhost device ID\n+ * @param vring_idx\n+ * vring index\n+ * @return\n+ * 0 on success, -1 on failure, -EAGAIN for another retry\n+ */\n+__rte_experimental\n+int rte_vhost_vring_call_nonblock(int vid, uint16_t vring_idx);\n+\n /**\n * Get vhost RX queue avail count.\n *\ndiff --git a/lib/vhost/version.map b/lib/vhost/version.map\nindex 7a00b65740..c8c44b8326 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -94,6 +94,9 @@ EXPERIMENTAL {\n \trte_vhost_async_try_dequeue_burst;\n \trte_vhost_driver_get_vdpa_dev_type;\n \trte_vhost_clear_queue;\n+\n+\t# added in 22.11\n+\trte_vhost_vring_call_nonblock;\n };\n \n INTERNAL {\ndiff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex 8740aa2788..ed6efb003f 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -1317,6 +1317,36 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx)\n \treturn 0;\n }\n \n+int\n+rte_vhost_vring_call_nonblock(int vid, uint16_t vring_idx)\n+{\n+\tstruct virtio_net *dev;\n+\tstruct vhost_virtqueue *vq;\n+\n+\tdev = get_device(vid);\n+\tif (!dev)\n+\t\treturn -1;\n+\n+\tif (vring_idx >= VHOST_MAX_VRING)\n+\t\treturn -1;\n+\n+\tvq = dev->virtqueue[vring_idx];\n+\tif (!vq)\n+\t\treturn -1;\n+\n+\tif (!rte_spinlock_trylock(&vq->access_lock))\n+\t\treturn -EAGAIN;\n+\n+\tif (vq_is_packed(dev))\n+\t\tvhost_vring_call_packed(dev, vq);\n+\telse\n+\t\tvhost_vring_call_split(dev, vq);\n+\n+\trte_spinlock_unlock(&vq->access_lock);\n+\n+\treturn 0;\n+}\n+\n uint16_t\n rte_vhost_avail_entries(int vid, uint16_t queue_id)\n {\n", "prefixes": [ "v4" ] }{ "id": 118253, "url": "