get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 124736,
    "url": "http://patches.dpdk.org/api/patches/124736/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1677782682-27200-1-git-send-email-roretzla@linux.microsoft.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": "<1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com",
    "date": "2023-03-02T18:44:41",
    "name": "[1/2] eal: fix failure race and behavior of thread create",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "9f674d6c8d717e9814816a7d205ed5accac9e180",
    "submitter": {
        "id": 2077,
        "url": "http://patches.dpdk.org/api/people/2077/?format=api",
        "name": "Tyler Retzlaff",
        "email": "roretzla@linux.microsoft.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 27232,
            "url": "http://patches.dpdk.org/api/series/27232/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27232",
            "date": "2023-03-02T18:44:42",
            "name": "[1/2] eal: fix failure race and behavior of thread create",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/27232/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/124736/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/124736/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 DB11641DB6;\n\tThu,  2 Mar 2023 19:44:51 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 15491427F5;\n\tThu,  2 Mar 2023 19:44:47 +0100 (CET)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id AC8E040E09;\n Thu,  2 Mar 2023 19:44:44 +0100 (CET)",
            "by linux.microsoft.com (Postfix, from userid 1086)\n id EB4C020B9C3D; Thu,  2 Mar 2023 10:44:43 -0800 (PST)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com EB4C020B9C3D",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1677782683;\n bh=xuZK/PT4vBYQyfE7YEavGvdJXFXwl7fUSKj7sgWKYWQ=;\n h=From:To:Cc:Subject:Date:From;\n b=JeLp7H0C9auqn8YS5CafRuWEIFHtVU+QwdQC3hmcKJKGD1EAAHFxseY5gMecKierO\n 9Vznx6nF+tYgoLjH0MxH6NZlil6ROi9JNfjrZPddtEytTimolUfteIoUurs7tFubIR\n GufApkhKKyOLX0VVokvkN6T3hd/J3lqcBBvU2yys=",
        "From": "Tyler Retzlaff <roretzla@linux.microsoft.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, Tyler Retzlaff <roretzla@linux.microsoft.com>,\n stable@dpdk.org",
        "Subject": "[PATCH 1/2] eal: fix failure race and behavior of thread create",
        "Date": "Thu,  2 Mar 2023 10:44:41 -0800",
        "Message-Id": "<1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "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": "In rte_thread_create setting affinity after pthread_create may fail.\nSuch a failure should result in the entire rte_thread_create failing\nbut doesn't.\n\nAdditionally if there is a failure to set affinity a race exists where\nthe creating thread will free ctx and depending on scheduling of the new\nthread it may also free ctx (double free).\n\nResolve both of the above issues by using the pthread_setaffinity_np\nprior to thread creation to set the affinity of the created thread. By\ndoing this no failure paths exist after pthread_create returns\nsuccessfully.\n\nFixes: ce6e911d20f6 (\"eal: add thread lifetime API\")\nCc: stable@dpdk.org\nCc: roretzla@linux.microsoft.com\n\nSigned-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>\n---\n lib/eal/unix/rte_thread.c | 20 +++++++++++---------\n 1 file changed, 11 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c\nindex 37ebfcf..5bf633b 100644\n--- a/lib/eal/unix/rte_thread.c\n+++ b/lib/eal/unix/rte_thread.c\n@@ -155,6 +155,17 @@ struct thread_routine_ctx {\n \t\t\tRTE_LOG(DEBUG, EAL, \"pthread_attr_setschedparam failed\\n\");\n \t\t\tgoto cleanup;\n \t\t}\n+\n+\t\tif (CPU_COUNT(&thread_attr->cpuset) > 0) {\n+\t\t\tret = pthread_attr_setaffinity_np(attrp,\n+\t\t\t\tsizeof(thread_attr->cpuset),\n+\t\t\t\t&thread_attr->cpuset);\n+\t\t\tif (ret != 0) {\n+\t\t\t\tRTE_LOG(DEBUG, EAL,\n+\t\t\t\t\t\"pthread_attr_setaffinity_np failed\\n\");\n+\t\t\t\tgoto cleanup;\n+\t\t\t}\n+\t\t}\n \t}\n \n \tret = pthread_create((pthread_t *)&thread_id->opaque_id, attrp,\n@@ -164,15 +175,6 @@ struct thread_routine_ctx {\n \t\tgoto cleanup;\n \t}\n \n-\tif (thread_attr != NULL && CPU_COUNT(&thread_attr->cpuset) > 0) {\n-\t\tret = rte_thread_set_affinity_by_id(*thread_id,\n-\t\t\t&thread_attr->cpuset);\n-\t\tif (ret != 0) {\n-\t\t\tRTE_LOG(DEBUG, EAL, \"rte_thread_set_affinity_by_id failed\\n\");\n-\t\t\tgoto cleanup;\n-\t\t}\n-\t}\n-\n \tctx = NULL;\n cleanup:\n \tfree(ctx);\n",
    "prefixes": [
        "1/2"
    ]
}