get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139671,
    "url": "http://patches.dpdk.org/api/patches/139671/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240423052018.81334-1-wujianyue000@163.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": "<20240423052018.81334-1-wujianyue000@163.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240423052018.81334-1-wujianyue000@163.com",
    "date": "2024-04-23T05:20:18",
    "name": "[v2] eal/linux: enhanced error handling for affinity",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8f49287119f1bc3d056860c35bbd5fd40936585d",
    "submitter": {
        "id": 3318,
        "url": "http://patches.dpdk.org/api/people/3318/?format=api",
        "name": "Jianyue Wu",
        "email": "wujianyue000@163.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240423052018.81334-1-wujianyue000@163.com/mbox/",
    "series": [
        {
            "id": 31817,
            "url": "http://patches.dpdk.org/api/series/31817/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31817",
            "date": "2024-04-23T05:20:18",
            "name": "[v2] eal/linux: enhanced error handling for affinity",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/31817/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139671/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/139671/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 75A1D43EF7;\n\tWed, 24 Apr 2024 16:18:32 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D1DCF434FE;\n\tWed, 24 Apr 2024 16:18:28 +0200 (CEST)",
            "from m16.mail.163.com (m16.mail.163.com [220.197.31.2])\n by mails.dpdk.org (Postfix) with ESMTP id A1F5E402AB\n for <dev@dpdk.org>; Tue, 23 Apr 2024 07:20:27 +0200 (CEST)",
            "from ubuntu2204.. (unknown [36.24.144.104])\n by gzga-smtp-mta-g3-1 (Coremail) with SMTP id\n _____wD332gURSdm_yINBg--.39914S2;\n Tue, 23 Apr 2024 13:20:21 +0800 (CST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=H4zWf\n 9YbRNCI0zPjJZQylR67xED3LRmDMzEa4BHfxbY=; b=Yf+nMYh0Kkx91uh4J1Xo/\n 8wHrY1KLzVQivrxiO3IuFZY3LUx7l/tsJ8YMekZ9bvLDqfbSI8oAaaSIc9vutFpN\n PPwQwZtcxmzAE1tdUi9L6lLC4Bvdb8YjJ73o3z6YoQXqJ2I2tZtqiZUcOjteZsd8\n x3VIKf3qjbZpv20qlxnEFM=",
        "From": "Jianyue Wu <wujianyue000@163.com>",
        "To": "",
        "Cc": "dev@dpdk.org,\n\tJianyue Wu <wujianyue000@163.com>",
        "Subject": "[PATCH v2] eal/linux: enhanced error handling for affinity",
        "Date": "Tue, 23 Apr 2024 13:20:18 +0800",
        "Message-Id": "<20240423052018.81334-1-wujianyue000@163.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-CM-TRANSID": "_____wD332gURSdm_yINBg--.39914S2",
        "X-Coremail-Antispam": "1Uf129KBjvJXoWxXryxAw4rXryrArW5CrWfZrb_yoW5Aw15pF\n Wjk34Utr4rAr47u343Ja1kZa4YyFnxWa17JrWxCr1fA39rWa15Zry5KFy5Wa15ur4UGan8\n ZrW3urZ09r4DJFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRDl1gUUUUU=",
        "X-Originating-IP": "[36.24.144.104]",
        "X-CM-SenderInfo": "5zxmxtpq1xviiqq6il2tof0z/1tbisBfJemV4JBDeywABsp",
        "X-Mailman-Approved-At": "Wed, 24 Apr 2024 16:18:26 +0200",
        "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": "Improve the robustness of setting thread affinity in DPDK\nby adding detailed error logging.\n\nChanges:\n1. Check the return value of pthread_setaffinity_np() and log an error\nif the call fails.\n2. Include the current thread name, the intended CPU set, and a detailed\nerror message in the log.\n\nSample prints:\nEAL: Cannot set affinity for thread dpdk-test with cpus 0,\nret: 22, errno: 0, error description: Success\nEAL: Cannot set affinity for thread dpdk-worker1 with cpus 1,\nret: 22, errno: 0, error description: Success\n\nSigned-off-by: Jianyue Wu <wujianyue000@163.com>\n---\n lib/eal/common/eal_common_thread.c |  2 +-\n lib/eal/common/eal_thread.h        |  2 +-\n lib/eal/unix/rte_thread.c          | 22 ++++++++++++++++++++--\n 3 files changed, 22 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c\nindex a53bc639ae..31a2fab2a7 100644\n--- a/lib/eal/common/eal_common_thread.c\n+++ b/lib/eal/common/eal_common_thread.c\n@@ -103,7 +103,7 @@ rte_thread_get_affinity(rte_cpuset_t *cpusetp)\n }\n \n int\n-eal_thread_dump_affinity(rte_cpuset_t *cpuset, char *str, unsigned int size)\n+eal_thread_dump_affinity(const rte_cpuset_t *cpuset, char *str, unsigned int size)\n {\n \tunsigned cpu;\n \tint ret;\ndiff --git a/lib/eal/common/eal_thread.h b/lib/eal/common/eal_thread.h\nindex 1c3c3442d3..85ab84baa5 100644\n--- a/lib/eal/common/eal_thread.h\n+++ b/lib/eal/common/eal_thread.h\n@@ -50,7 +50,7 @@ unsigned eal_cpu_socket_id(unsigned cpu_id);\n  *   0 for success, -1 if truncation happens.\n  */\n int\n-eal_thread_dump_affinity(rte_cpuset_t *cpuset, char *str, unsigned int size);\n+eal_thread_dump_affinity(const rte_cpuset_t *cpuset, char *str, unsigned int size);\n \n /**\n  * Dump the current thread cpuset.\ndiff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c\nindex 1b4c73f58e..8f9eaf0dcf 100644\n--- a/lib/eal/unix/rte_thread.c\n+++ b/lib/eal/unix/rte_thread.c\n@@ -369,8 +369,26 @@ int\n rte_thread_set_affinity_by_id(rte_thread_t thread_id,\n \t\tconst rte_cpuset_t *cpuset)\n {\n-\treturn pthread_setaffinity_np((pthread_t)thread_id.opaque_id,\n-\t\tsizeof(*cpuset), cpuset);\n+\tint ret;\n+\tchar cpus_str[RTE_CPU_AFFINITY_STR_LEN] = {'\\0'};\n+\tchar thread_name[RTE_MAX_THREAD_NAME_LEN] = {'\\0'};\n+\n+\terrno = 0;\n+\tret = pthread_setaffinity_np((pthread_t)thread_id.opaque_id,\n+\t\t\t\tsizeof(*cpuset), cpuset);\n+\tif (ret != 0) {\n+\t\tif (pthread_getname_np((pthread_t)thread_id.opaque_id,\n+\t\t\t\t\tthread_name, sizeof(thread_name)) != 0)\n+\t\t\tEAL_LOG(ERR, \"pthread_getname_np failed!\");\n+\t\tif (eal_thread_dump_affinity(cpuset, cpus_str, RTE_CPU_AFFINITY_STR_LEN) != 0)\n+\t\t\tEAL_LOG(ERR, \"eal_thread_dump_affinity failed!\");\n+\t\tEAL_LOG(ERR, \"Cannot set affinity for thread %s with cpus %s, \"\n+\t\t\t\"ret: %d, errno: %d, error description: %s\",\n+\t\t\tthread_name, cpus_str,\n+\t\t\tret, errno, strerror(errno));\n+\t}\n+\n+\treturn ret;\n }\n \n int\n",
    "prefixes": [
        "v2"
    ]
}