get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137485,
    "url": "http://patches.dpdk.org/api/patches/137485/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240229122502.2572343-7-maxime.coquelin@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": "<20240229122502.2572343-7-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240229122502.2572343-7-maxime.coquelin@redhat.com",
    "date": "2024-02-29T12:25:01",
    "name": "[6/7] vhost: convert fdset sync to eventfd",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c89ef5e205ed1e25a34d2de9c04bda39a6f8410c",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@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/20240229122502.2572343-7-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 31293,
            "url": "http://patches.dpdk.org/api/series/31293/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31293",
            "date": "2024-02-29T12:24:55",
            "name": "vhost: FD manager improvements",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/31293/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/137485/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/137485/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 92E5643C36;\n\tThu, 29 Feb 2024 13:25:48 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4E35442DEF;\n\tThu, 29 Feb 2024 13:25:23 +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 A545742D72\n for <dev@dpdk.org>; Thu, 29 Feb 2024 13:25:17 +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.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-371-VoG6xYfWPvSoFoA5ab2Fog-1; Thu, 29 Feb 2024 07:25:15 -0500",
            "from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com\n [10.11.54.3])\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 6BCE110651E6;\n Thu, 29 Feb 2024 12:25:15 +0000 (UTC)",
            "from max-p1.redhat.com (unknown [10.39.208.20])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 291AE111D3DA;\n Thu, 29 Feb 2024 12:25:14 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1709209517;\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=LmF7qPGs1eZr0guitFSXpVk4EJJ8BM7JQyUuHQzD+ws=;\n b=hVp6jSsb9PukqW0pGjWa4xQrZUZAbgHYLAh/20k5WichlnH/NNGNXByCKziEkQFyOu3RMJ\n h7SGVd16v1QiBmVftB5RYzrjKdmyAFJBaQMS9mmiQ6RDBDgvJzoy8pwBZxtRKx3oRjxbDD\n NEW4JZnzN18o02zqypoibmvrms32poE=",
        "X-MC-Unique": "VoG6xYfWPvSoFoA5ab2Fog-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org,\n\tdavid.marchand@redhat.com,\n\tchenbox@nvidia.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Subject": "[PATCH 6/7] vhost: convert fdset sync to eventfd",
        "Date": "Thu, 29 Feb 2024 13:25:01 +0100",
        "Message-ID": "<20240229122502.2572343-7-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20240229122502.2572343-1-maxime.coquelin@redhat.com>",
        "References": "<20240229122502.2572343-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.3",
        "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": "This patch converts fdset's sync mechanism from\npipe to eventfd, as we only use it to send\nnotification events.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/vhost/fd_man.c | 65 +++++++++++++++++++---------------------------\n 1 file changed, 26 insertions(+), 39 deletions(-)",
    "diff": "diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c\nindex 8b47c97d45..6a5bd74656 100644\n--- a/lib/vhost/fd_man.c\n+++ b/lib/vhost/fd_man.c\n@@ -6,6 +6,7 @@\n #include <pthread.h>\n #include <stdio.h>\n #include <string.h>\n+#include <sys/eventfd.h>\n #include <unistd.h>\n \n #include <rte_common.h>\n@@ -40,19 +41,11 @@ struct fdset {\n \tpthread_mutex_t fd_polling_mutex;\n \tint num;\t/* current fd number of this fdset */\n \n-\tunion pipefds {\n-\t\tstruct {\n-\t\t\tint pipefd[2];\n-\t\t};\n-\t\tstruct {\n-\t\t\tint readfd;\n-\t\t\tint writefd;\n-\t\t};\n-\t} u;\n-\n+\tint sync_fd;\n \tpthread_mutex_t sync_mutex;\n \tpthread_cond_t sync_cond;\n \tbool sync;\n+\n \tbool destroy;\n };\n \n@@ -97,12 +90,11 @@ fdset_insert(struct fdset *fdset)\n }\n \n static void\n-fdset_pipe_read_cb(int readfd, void *dat,\n-\t\t   int *remove __rte_unused)\n+fdset_sync_read_cb(int sync_fd, void *dat, int *remove __rte_unused)\n {\n-\tchar charbuf[16];\n+\teventfd_t val;\n \tstruct fdset *fdset = dat;\n-\tint r = read(readfd, charbuf, sizeof(charbuf));\n+\tint r = eventfd_read(sync_fd, &val);\n \t/*\n \t * Just an optimization, we don't care if read() failed\n \t * so ignore explicitly its return value to make the\n@@ -117,37 +109,33 @@ fdset_pipe_read_cb(int readfd, void *dat,\n }\n \n static void\n-fdset_pipe_uninit(struct fdset *fdset)\n+fdset_sync_uninit(struct fdset *fdset)\n {\n-\tfdset_del(fdset, fdset->u.readfd);\n-\tclose(fdset->u.readfd);\n-\tfdset->u.readfd = -1;\n-\tclose(fdset->u.writefd);\n-\tfdset->u.writefd = -1;\n+\tfdset_del(fdset, fdset->sync_fd);\n+\tclose(fdset->sync_fd);\n+\tfdset->sync_fd = -1;\n }\n \n static int\n-fdset_pipe_init(struct fdset *fdset)\n+fdset_sync_init(struct fdset *fdset)\n {\n \tint ret;\n \n \tpthread_mutex_init(&fdset->sync_mutex, NULL);\n \tpthread_cond_init(&fdset->sync_cond, NULL);\n \n-\tif (pipe(fdset->u.pipefd) < 0) {\n-\t\tVHOST_FDMAN_LOG(ERR,\n-\t\t\t\"failed to create pipe for vhost fdset\");\n+\tfdset->sync_fd = eventfd(0, 0);\n+\tif (fdset->sync_fd < 0) {\n+\t\tVHOST_FDMAN_LOG(ERR, \"failed to create eventfd for %s fdset\", fdset->name);\n \t\treturn -1;\n \t}\n \n-\tret = fdset_add_no_sync(fdset, fdset->u.readfd,\n-\t\t\tfdset_pipe_read_cb, NULL, fdset);\n+\tret = fdset_add_no_sync(fdset, fdset->sync_fd, fdset_sync_read_cb, NULL, fdset);\n \tif (ret < 0) {\n-\t\tVHOST_FDMAN_LOG(ERR,\n-\t\t\t\"failed to add pipe readfd %d into vhost server fdset\",\n-\t\t\tfdset->u.readfd);\n+\t\tVHOST_FDMAN_LOG(ERR, \"failed to add eventfd %d to %s fdset\",\n+\t\t\tfdset->sync_fd, fdset->name);\n \n-\t\tfdset_pipe_uninit(fdset);\n+\t\tfdset_sync_uninit(fdset);\n \t\treturn -1;\n \t}\n \n@@ -162,11 +150,10 @@ fdset_sync(struct fdset *fdset)\n \tpthread_mutex_lock(&fdset->sync_mutex);\n \n \tfdset->sync = false;\n-\tret = write(fdset->u.writefd, \"1\", 1);\n+\tret = eventfd_write(fdset->sync_fd, (eventfd_t)1);\n \tif (ret < 0) {\n-\t\tVHOST_FDMAN_LOG(ERR,\n-\t\t\t\"Failed to write to notification pipe: %s\",\n-\t\t\tstrerror(errno));\n+\t\tVHOST_FDMAN_LOG(ERR, \"Failed to write sync eventfd for %s fdset: %s\",\n+\t\t\tfdset->name, strerror(errno));\n \t\tgoto out_unlock;\n \t}\n \n@@ -292,8 +279,8 @@ fdset_init(const char *name)\n \t}\n \tfdset->num = 0;\n \n-\tif (fdset_pipe_init(fdset)) {\n-\t\tVHOST_FDMAN_LOG(ERR, \"Failed to init pipe for %s\", name);\n+\tif (fdset_sync_init(fdset)) {\n+\t\tVHOST_FDMAN_LOG(ERR, \"Failed to init sync for %s\", name);\n \t\tgoto err_free;\n \t}\n \n@@ -301,7 +288,7 @@ fdset_init(const char *name)\n \t\t\t\t\tfdset_event_dispatch, fdset)) {\n \t\tVHOST_FDMAN_LOG(ERR, \"Failed to create %s event dispatch thread\",\n \t\t\t\tfdset->name);\n-\t\tgoto err_pipe;\n+\t\tgoto err_sync;\n \t}\n \n \tif (fdset_insert(fdset)) {\n@@ -317,8 +304,8 @@ fdset_init(const char *name)\n \tfdset->destroy = true;\n \tfdset_sync(fdset);\n \trte_thread_join(fdset->tid, &val);\n-err_pipe:\n-\tfdset_pipe_uninit(fdset);\n+err_sync:\n+\tfdset_sync_uninit(fdset);\n err_free:\n \trte_free(fdset);\n err_unlock:\n",
    "prefixes": [
        "6/7"
    ]
}