get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/134868/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 134868,
    "url": "http://patches.dpdk.org/api/patches/134868/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231205094536.2816720-1-david.marchand@redhat.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": "<20231205094536.2816720-1-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231205094536.2816720-1-david.marchand@redhat.com",
    "date": "2023-12-05T09:45:31",
    "name": "[v2,1/5] vhost: fix virtqueue access check in datapath",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6e4e3c76b659bc12af5763349e0ed293fe0dbb12",
    "submitter": {
        "id": 1173,
        "url": "http://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.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/20231205094536.2816720-1-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 30453,
            "url": "http://patches.dpdk.org/api/series/30453/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30453",
            "date": "2023-12-05T09:45:31",
            "name": "[v2,1/5] vhost: fix virtqueue access check in datapath",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/30453/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/134868/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/134868/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 DC87743676;\n\tTue,  5 Dec 2023 10:45:53 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F118642E0B;\n\tTue,  5 Dec 2023 10:45:51 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 2690542D45\n for <dev@dpdk.org>; Tue,  5 Dec 2023 10:45:48 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73])\n by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-FopFTVPgN_eSEzVhBr_iqA-1; Tue,\n 05 Dec 2023 04:45:45 -0500",
            "from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com\n [10.11.54.7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A2BD2806050;\n Tue,  5 Dec 2023 09:45:45 +0000 (UTC)",
            "from dmarchan.redhat.com (unknown [10.45.225.216])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 8239F1C060AF;\n Tue,  5 Dec 2023 09:45:44 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1701769547;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=pqxHQ2dkDWcgvv9I6cJiJtlXVNwHrL6laP+mrMphIVY=;\n b=PHJklC8jpa1NjMHRhcf3JhM2ZSjwvePK8VjU3AOg86Wh2Xrddo6Off2nZsaPCz2VFCYdpa\n kj/JBKgYlFAtpnDXUToUCj9+4ftRExV4mtmwQunLdPNTO7pLsM9LNOg4O4lVtx+sMhPfvy\n 2I4LBKX8BiUOIfMxj9JLfx+W+zb79Qs=",
        "X-MC-Unique": "FopFTVPgN_eSEzVhBr_iqA-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org, Eelco Chaudron <echaudro@redhat.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbox@nvidia.com>",
        "Subject": "[PATCH v2 1/5] vhost: fix virtqueue access check in datapath",
        "Date": "Tue,  5 Dec 2023 10:45:31 +0100",
        "Message-ID": "<20231205094536.2816720-1-david.marchand@redhat.com>",
        "In-Reply-To": "<20231023095520.2864868-1-david.marchand@redhat.com>",
        "References": "<20231023095520.2864868-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.7",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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": "Now that a r/w lock is used, the access_ok field should only be updated\nunder a write lock.\n\nSince the datapath code only takes a read lock on the virtqueue to check\naccess_ok, this lock must be released and a write lock taken before\ncalling vring_translate().\n\nFixes: 03f77d66d966 (\"vhost: change virtqueue access lock to a read/write one\")\nCc: stable@dpdk.org\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\nAcked-by: Eelco Chaudron <echaudro@redhat.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/vhost/virtio_net.c | 60 +++++++++++++++++++++++++++++++-----------\n 1 file changed, 44 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex 8af20f1487..d00f4b03aa 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -1696,6 +1696,17 @@ virtio_dev_rx_packed(struct virtio_net *dev,\n \treturn pkt_idx;\n }\n \n+static void\n+virtio_dev_vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq)\n+{\n+\trte_rwlock_write_lock(&vq->access_lock);\n+\tvhost_user_iotlb_rd_lock(vq);\n+\tif (!vq->access_ok)\n+\t\tvring_translate(dev, vq);\n+\tvhost_user_iotlb_rd_unlock(vq);\n+\trte_rwlock_write_unlock(&vq->access_lock);\n+}\n+\n static __rte_always_inline uint32_t\n virtio_dev_rx(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct rte_mbuf **pkts, uint32_t count)\n@@ -1710,9 +1721,13 @@ virtio_dev_rx(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \n \tvhost_user_iotlb_rd_lock(vq);\n \n-\tif (unlikely(!vq->access_ok))\n-\t\tif (unlikely(vring_translate(dev, vq) < 0))\n-\t\t\tgoto out;\n+\tif (unlikely(!vq->access_ok)) {\n+\t\tvhost_user_iotlb_rd_unlock(vq);\n+\t\trte_rwlock_read_unlock(&vq->access_lock);\n+\n+\t\tvirtio_dev_vring_translate(dev, vq);\n+\t\tgoto out_no_unlock;\n+\t}\n \n \tcount = RTE_MIN((uint32_t)MAX_PKT_BURST, count);\n \tif (count == 0)\n@@ -1731,6 +1746,7 @@ virtio_dev_rx(struct virtio_net *dev, struct vhost_virtqueue *vq,\n out_access_unlock:\n \trte_rwlock_read_unlock(&vq->access_lock);\n \n+out_no_unlock:\n \treturn nb_tx;\n }\n \n@@ -2528,9 +2544,13 @@ virtio_dev_rx_async_submit(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \n \tvhost_user_iotlb_rd_lock(vq);\n \n-\tif (unlikely(!vq->access_ok))\n-\t\tif (unlikely(vring_translate(dev, vq) < 0))\n-\t\t\tgoto out;\n+\tif (unlikely(!vq->access_ok)) {\n+\t\tvhost_user_iotlb_rd_unlock(vq);\n+\t\trte_rwlock_read_unlock(&vq->access_lock);\n+\n+\t\tvirtio_dev_vring_translate(dev, vq);\n+\t\tgoto out_no_unlock;\n+\t}\n \n \tcount = RTE_MIN((uint32_t)MAX_PKT_BURST, count);\n \tif (count == 0)\n@@ -2551,6 +2571,7 @@ virtio_dev_rx_async_submit(struct virtio_net *dev, struct vhost_virtqueue *vq,\n out_access_unlock:\n \trte_rwlock_write_unlock(&vq->access_lock);\n \n+out_no_unlock:\n \treturn nb_tx;\n }\n \n@@ -3581,11 +3602,13 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,\n \n \tvhost_user_iotlb_rd_lock(vq);\n \n-\tif (unlikely(!vq->access_ok))\n-\t\tif (unlikely(vring_translate(dev, vq) < 0)) {\n-\t\t\tcount = 0;\n-\t\t\tgoto out;\n-\t\t}\n+\tif (unlikely(!vq->access_ok)) {\n+\t\tvhost_user_iotlb_rd_unlock(vq);\n+\t\trte_rwlock_read_unlock(&vq->access_lock);\n+\n+\t\tvirtio_dev_vring_translate(dev, vq);\n+\t\tgoto out_no_unlock;\n+\t}\n \n \t/*\n \t * Construct a RARP broadcast packet, and inject it to the \"pkts\"\n@@ -3646,6 +3669,7 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,\n \tif (unlikely(rarp_mbuf != NULL))\n \t\tcount += 1;\n \n+out_no_unlock:\n \treturn count;\n }\n \n@@ -4196,11 +4220,14 @@ rte_vhost_async_try_dequeue_burst(int vid, uint16_t queue_id,\n \n \tvhost_user_iotlb_rd_lock(vq);\n \n-\tif (unlikely(vq->access_ok == 0))\n-\t\tif (unlikely(vring_translate(dev, vq) < 0)) {\n-\t\t\tcount = 0;\n-\t\t\tgoto out;\n-\t\t}\n+\tif (unlikely(vq->access_ok == 0)) {\n+\t\tvhost_user_iotlb_rd_unlock(vq);\n+\t\trte_rwlock_read_unlock(&vq->access_lock);\n+\n+\t\tvirtio_dev_vring_translate(dev, vq);\n+\t\tcount = 0;\n+\t\tgoto out_no_unlock;\n+\t}\n \n \t/*\n \t * Construct a RARP broadcast packet, and inject it to the \"pkts\"\n@@ -4266,5 +4293,6 @@ rte_vhost_async_try_dequeue_burst(int vid, uint16_t queue_id,\n \tif (unlikely(rarp_mbuf != NULL))\n \t\tcount += 1;\n \n+out_no_unlock:\n \treturn count;\n }\n",
    "prefixes": [
        "v2",
        "1/5"
    ]
}