Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/118242/?format=api
http://patches.dpdk.org/api/patches/118242/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221017071457.28589-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": "<20221017071457.28589-1-changpeng.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221017071457.28589-1-changpeng.liu@intel.com", "date": "2022-10-17T07:14:57", "name": "[v3] vhost: add new `rte_vhost_vring_call_nonblock` API", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "55787d29f26f2d6a7d89c9cabf2d4102719251d6", "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/20221017071457.28589-1-changpeng.liu@intel.com/mbox/", "series": [ { "id": 25247, "url": "http://patches.dpdk.org/api/series/25247/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25247", "date": "2022-10-17T07:14:57", "name": "[v3] vhost: add new `rte_vhost_vring_call_nonblock` API", "version": 3, "mbox": "http://patches.dpdk.org/series/25247/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/118242/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/118242/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 676D0A0556;\n\tMon, 17 Oct 2022 09:15:15 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 00D5B40143;\n\tMon, 17 Oct 2022 09:15:15 +0200 (CEST)", "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id 2872F400D7\n for <dev@dpdk.org>; Mon, 17 Oct 2022 09:15:12 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Oct 2022 00:15:12 -0700", "from waikikibeach52.sh.intel.com ([10.67.111.175])\n by fmsmga001.fm.intel.com with ESMTP; 17 Oct 2022 00:15:10 -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=1665990913; x=1697526913;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=jn2AqdptVTD/lH656vBR4mGhcpvPEGf+Y4o/E8UhmDE=;\n b=C+H20wdsElSl0vn3ICun7B4h3uC6+m9bRjdEmHYGnLKhtm5EBk5DPzWy\n Gk4+wKgle8m6sTMlTdeCAHXdDqzP2mm15WRCHbu+C2txjaNKDKPSGTGSq\n YFDg+FTBPRyk80Xyi4ILu0jxTJKoKA2rvcEAArSfGqjlz4s+ntcg+eTwq\n u/cvxl8fKr/IOYBQPKTe+AijaZrgQ0/vV1koGxgbwzRcaD2olA+KV/cl6\n wbQEyMImDQ03XmHcBjMKyAmcYHiGGJ/iNCdiCRYJ9hJ9Zhcf9DEiEKjG6\n 6bKQfYcO4KjgrtrvfuhEMGbpQHp9BTpI20dd2KARcZ0ouShzLtRYl/b5N A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6500,9779,10502\"; a=\"289016484\"", "E=Sophos;i=\"5.95,190,1661842800\"; d=\"scan'208\";a=\"289016484\"", "E=McAfee;i=\"6500,9779,10502\"; a=\"770665128\"", "E=Sophos;i=\"5.95,190,1661842800\"; d=\"scan'208\";a=\"770665128\"" ], "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 v3] vhost: add new `rte_vhost_vring_call_nonblock` API", "Date": "Mon, 17 Oct 2022 15:14:57 +0800", "Message-Id": "<20221017071457.28589-1-changpeng.liu@intel.com>", "X-Mailer": "git-send-email 2.21.3", "In-Reply-To": "<20221012064007.56040-1-changpeng.liu@intel.com>", "References": "<20221012064007.56040-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..9b3783ffd8 100644\n--- a/doc/guides/rel_notes/release_22_11.rst\n+++ b/doc/guides/rel_notes/release_22_11.rst\n@@ -236,6 +236,12 @@ New Features\n \n strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'\n \n+* **Added non-block notify API to the vhost library.**\n+\n+ Added API to notify the guest that used descriptors have been added\n+ to the vring in non-block way, user should check the return value of\n+ this API.\n+\n \n Removed Items\n -------------\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": [ "v3" ] }{ "id": 118242, "url": "