get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 77292,
    "url": "http://patches.dpdk.org/api/patches/77292/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200911015316.1903181-5-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-5-patrick.fu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200911015316.1903181-5-patrick.fu@intel.com",
    "date": "2020-09-11T01:53:16",
    "name": "[v1,4/4] vhost: fix async register/unregister deadlock",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0f0e9a95b0da6498a0bcc88f3276f3e677913b6d",
    "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-5-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/77292/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/77292/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 54A8BA04B5;\n\tFri, 11 Sep 2020 04:01:26 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BD3CE1C20A;\n\tFri, 11 Sep 2020 03:59:44 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by dpdk.org (Postfix) with ESMTP id DFB4C1C199\n for <dev@dpdk.org>; Fri, 11 Sep 2020 03:59:43 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Sep 2020 18:59:43 -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:40 -0700"
        ],
        "IronPort-SDR": [
            "\n 9ZxFyHOwmwyv9gSfa1NDgUQowfTQxHugCfYahbWw4d1WcEdY9aWELRsIg/Qpdwzd+Y00honytv\n ZOoqTD2Zj/AA==",
            "\n FOB5vsQ8XaVLZPGc/lUAyBvOTxFBdzGWSR9nOSdhUSFeXNdOVN/lWOSGIJ8liZWrFa5/DRssNp\n UMR2xvvO0CSg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9740\"; a=\"243496147\"",
            "E=Sophos;i=\"5.76,413,1592895600\"; d=\"scan'208\";a=\"243496147\"",
            "E=Sophos;i=\"5.76,413,1592895600\"; d=\"scan'208\";a=\"318121889\""
        ],
        "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:16 +0800",
        "Message-Id": "<20200911015316.1903181-5-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 4/4] vhost: fix async register/unregister\n\tdeadlock",
        "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": "When async register/unregister function is invoked in certain vhost\nevent callbacks (e.g. vring state change), deadlock may occur due to\nrecursive spinlock acquire. This patch removes unnecessary spinlock\nfrom register API and use trylock() primitive in the unregister API\nto avoid deadlock.\n\nFixes: 78639d54563a (\"vhost: introduce async enqueue registration API\")\n\nSigned-off-by: Patrick Fu <patrick.fu@intel.com>\n---\n lib/librte_vhost/vhost.c      | 13 +++++++------\n lib/librte_vhost/vhost_user.c |  4 ++--\n 2 files changed, 9 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex ba374da67..8c2fee6b6 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -1576,8 +1576,6 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n \t\tops->transfer_data == NULL))\n \t\treturn -1;\n \n-\trte_spinlock_lock(&vq->access_lock);\n-\n \tif (unlikely(vq->async_registered)) {\n \t\tVHOST_LOG_CONFIG(ERR,\n \t\t\t\"async register failed: channel already registered \"\n@@ -1615,8 +1613,6 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id,\n \tvq->async_registered = true;\n \n reg_out:\n-\trte_spinlock_unlock(&vq->access_lock);\n-\n \treturn 0;\n }\n \n@@ -1635,10 +1631,15 @@ int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)\n \t\treturn ret;\n \n \tret = 0;\n-\trte_spinlock_lock(&vq->access_lock);\n \n \tif (!vq->async_registered)\n-\t\tgoto out;\n+\t\treturn ret;\n+\n+\tif (!rte_spinlock_trylock(&vq->access_lock)) {\n+\t\tVHOST_LOG_CONFIG(ERR, \"Failed to unregister async channel. \"\n+\t\t\t\"virt queue busy.\\n\");\n+\t\treturn -1;\n+\t}\n \n \tif (vq->async_pkts_inflight_n) {\n \t\tVHOST_LOG_CONFIG(ERR, \"Failed to unregister async channel. \"\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex f6cdbede7..39cd57aeb 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -2043,9 +2043,9 @@ vhost_user_set_vring_enable(struct virtio_net **pdev,\n \t\t\"set queue enable: %d to qp idx: %d\\n\",\n \t\tenable, index);\n \n-\tif (!enable && dev->virtqueue[index]->async_registered) {\n+\tif (enable && dev->virtqueue[index]->async_registered) {\n \t\tif (dev->virtqueue[index]->async_pkts_inflight_n) {\n-\t\t\tVHOST_LOG_CONFIG(ERR, \"failed to disable vring. \"\n+\t\t\tVHOST_LOG_CONFIG(ERR, \"failed to enable vring. \"\n \t\t\t\"async inflight packets must be completed first\\n\");\n \t\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n \t\t}\n",
    "prefixes": [
        "v1",
        "4/4"
    ]
}