Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/122853/?format=api
http://patchwork.dpdk.org/api/patches/122853/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230201111411.1509520-4-david.marchand@redhat.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20230201111411.1509520-4-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230201111411.1509520-4-david.marchand@redhat.com", "date": "2023-02-01T11:14:05", "name": "[v5,3/9] vhost: terminate when access lock is not taken", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "4c1d4a1f54bb00ee2c4b77f23ba3cab78d519b9e", "submitter": { "id": 1173, "url": "http://patchwork.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230201111411.1509520-4-david.marchand@redhat.com/mbox/", "series": [ { "id": 26733, "url": "http://patchwork.dpdk.org/api/series/26733/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=26733", "date": "2023-02-01T11:14:02", "name": "Lock annotations", "version": 5, "mbox": "http://patchwork.dpdk.org/series/26733/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/122853/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/122853/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 73ED841B9E;\n\tWed, 1 Feb 2023 12:16:08 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D778042D3C;\n\tWed, 1 Feb 2023 12:16:03 +0100 (CET)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id DDF574021F\n for <dev@dpdk.org>; Wed, 1 Feb 2023 12:16:01 +0100 (CET)", "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-294-FZrRK9zgMFq9Bmdx61muDQ-1; Wed, 01 Feb 2023 06:15:58 -0500", "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com\n [10.11.54.2])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00373858F09;\n Wed, 1 Feb 2023 11:15:58 +0000 (UTC)", "from dmarchan.redhat.com (ovpn-192-67.brq.redhat.com [10.40.192.67])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 72373400EAD6;\n Wed, 1 Feb 2023 11:15:56 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1675250161;\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=6o/XSwjlvIUwbtrX+Whqin61X9r3y3q7grQRkbfS/LQ=;\n b=FwJoGMsrzpJCQwqmF9L87AkPFZM8l2uXmRkEkQq737OcsrxNY1dr5LmKZeMAiDf4cz2FNn\n +bvEZZt/uyPPD9ps0/EFWwNspebBhulSzUWqNPO0SW6nT0vXLJwwqOjMqBNrNyycuRj5Si\n kh5PihtWcf7pjiG4eC++jdUyTdeg/6U=", "X-MC-Unique": "FZrRK9zgMFq9Bmdx61muDQ-1", "From": "David Marchand <david.marchand@redhat.com>", "To": "dev@dpdk.org", "Cc": "maxime.coquelin@redhat.com, stephen@networkplumber.org,\n chenbo.xia@intel.com, jiayu.hu@intel.com, yuanx.wang@intel.com,\n xuan.ding@intel.com, mb@smartsharesystems.com", "Subject": "[PATCH v5 3/9] vhost: terminate when access lock is not taken", "Date": "Wed, 1 Feb 2023 12:14:05 +0100", "Message-Id": "<20230201111411.1509520-4-david.marchand@redhat.com>", "In-Reply-To": "<20230201111411.1509520-1-david.marchand@redhat.com>", "References": "<20220328121758.26632-1-david.marchand@redhat.com>\n <20230201111411.1509520-1-david.marchand@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.2", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=UTF-8", "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": "Be a bit more strict when a programmatic error is detected with regards to\nthe access_lock not being taken.\nMark the new helper with __rte_assert_exclusive_lock so that clang\nunderstands where locks are expected to be taken.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/vhost/vhost.c | 18 +++---------------\n lib/vhost/vhost.h | 10 ++++++++++\n lib/vhost/virtio_net.c | 6 +-----\n 3 files changed, 14 insertions(+), 20 deletions(-)", "diff": "diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c\nindex 19c7b92c32..8cd727ca2f 100644\n--- a/lib/vhost/vhost.c\n+++ b/lib/vhost/vhost.c\n@@ -1781,11 +1781,7 @@ rte_vhost_async_channel_register_thread_unsafe(int vid, uint16_t queue_id)\n \tif (unlikely(vq == NULL || !dev->async_copy))\n \t\treturn -1;\n \n-\tif (unlikely(!rte_spinlock_is_locked(&vq->access_lock))) {\n-\t\tVHOST_LOG_CONFIG(dev->ifname, ERR, \"%s() called without access lock taken.\\n\",\n-\t\t\t__func__);\n-\t\treturn -1;\n-\t}\n+\tvq_assert_lock(dev, vq);\n \n \treturn async_channel_register(dev, vq);\n }\n@@ -1847,11 +1843,7 @@ rte_vhost_async_channel_unregister_thread_unsafe(int vid, uint16_t queue_id)\n \tif (vq == NULL)\n \t\treturn -1;\n \n-\tif (unlikely(!rte_spinlock_is_locked(&vq->access_lock))) {\n-\t\tVHOST_LOG_CONFIG(dev->ifname, ERR, \"%s() called without access lock taken.\\n\",\n-\t\t\t__func__);\n-\t\treturn -1;\n-\t}\n+\tvq_assert_lock(dev, vq);\n \n \tif (!vq->async)\n \t\treturn 0;\n@@ -1994,11 +1986,7 @@ rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t queue_id)\n \tif (vq == NULL)\n \t\treturn ret;\n \n-\tif (unlikely(!rte_spinlock_is_locked(&vq->access_lock))) {\n-\t\tVHOST_LOG_CONFIG(dev->ifname, ERR, \"%s() called without access lock taken.\\n\",\n-\t\t\t__func__);\n-\t\treturn -1;\n-\t}\n+\tvq_assert_lock(dev, vq);\n \n \tif (!vq->async)\n \t\treturn ret;\ndiff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h\nindex ef211ed519..f6b2930efd 100644\n--- a/lib/vhost/vhost.h\n+++ b/lib/vhost/vhost.h\n@@ -512,6 +512,16 @@ struct virtio_net {\n \tstruct rte_vhost_user_extern_ops extern_ops;\n } __rte_cache_aligned;\n \n+static inline void\n+vq_assert_lock__(struct virtio_net *dev, struct vhost_virtqueue *vq, const char *func)\n+\t__rte_assert_exclusive_lock(&vq->access_lock)\n+{\n+\tif (unlikely(!rte_spinlock_is_locked(&vq->access_lock)))\n+\t\trte_panic(\"VHOST_CONFIG: (%s) %s() called without access lock taken.\\n\",\n+\t\t\tdev->ifname, func);\n+}\n+#define vq_assert_lock(dev, vq) vq_assert_lock__(dev, vq, __func__)\n+\n static __rte_always_inline bool\n vq_is_packed(struct virtio_net *dev)\n {\ndiff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex 9abf752f30..2a75cda7b6 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -2185,11 +2185,7 @@ rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t queue_id,\n \n \tvq = dev->virtqueue[queue_id];\n \n-\tif (unlikely(!rte_spinlock_is_locked(&vq->access_lock))) {\n-\t\tVHOST_LOG_DATA(dev->ifname, ERR, \"%s() called without access lock taken.\\n\",\n-\t\t\t__func__);\n-\t\treturn -1;\n-\t}\n+\tvq_assert_lock(dev, vq);\n \n \tif (unlikely(!vq->async)) {\n \t\tVHOST_LOG_DATA(dev->ifname, ERR,\n", "prefixes": [ "v5", "3/9" ] }{ "id": 122853, "url": "