get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131202,
    "url": "http://patchwork.dpdk.org/api/patches/131202/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230906162226.1618088-6-thomas@monjalon.net/",
    "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": "<20230906162226.1618088-6-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230906162226.1618088-6-thomas@monjalon.net",
    "date": "2023-09-06T16:12:22",
    "name": "[05/11] eal: force prefix for internal threads",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "02ba8026d4540a373d66efbe2f14f4c5d7c8f5c0",
    "submitter": {
        "id": 685,
        "url": "http://patchwork.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "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/20230906162226.1618088-6-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 29438,
            "url": "http://patchwork.dpdk.org/api/series/29438/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29438",
            "date": "2023-09-06T16:12:17",
            "name": "rework thread management",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/29438/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/131202/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/131202/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 5028B42529;\n\tWed,  6 Sep 2023 18:23:28 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C826D4027E;\n\tWed,  6 Sep 2023 18:23:24 +0200 (CEST)",
            "from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com\n [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 98363402E2\n for <dev@dpdk.org>; Wed,  6 Sep 2023 18:23:23 +0200 (CEST)",
            "from compute5.internal (compute5.nyi.internal [10.202.2.45])\n by mailout.west.internal (Postfix) with ESMTP id 73D24320096D;\n Wed,  6 Sep 2023 12:23:22 -0400 (EDT)",
            "from mailfrontend2 ([10.202.2.163])\n by compute5.internal (MEProxy); Wed, 06 Sep 2023 12:23:22 -0400",
            "by mail.messagingengine.com (Postfix) with ESMTPA; Wed,\n 6 Sep 2023 12:23:20 -0400 (EDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n cc:cc:content-transfer-encoding:content-type:date:date:from:from\n :in-reply-to:in-reply-to:message-id:mime-version:references\n :reply-to:sender:subject:subject:to:to; s=fm1; t=1694017401; x=\n 1694103801; bh=rxG68et7JQxcK2X0nZ4GmZrJdcC0SauWMLlPbucInN8=; b=j\n x/GpcZieNepdFXHXoqtAK+c7fwpg3g5yEvjYP78tnoSnq0ifzeJ5AyWV25//68MU\n cLolvQj+vH6SMmnsZHx4NQqADqNLhKGbkvxuKKuuIkWHGcBk/az5onpKxSq6s6Am\n EJult3w2jqRfGBxj2CrLMD2Ui6T67XbLPRvk7EZvnVvRhWSbA0rr7mK1EJ/6IFzG\n f5fRhu28tAvNM7lZznBp7z78sVp23v8EvdlaANxzis7bq71QtT7VtQbIWER2vohi\n DQnThJB+FjJn3Fo01OhIIyoZxN+flm2zt96pZQ+5Mgp7/nICfQPjXg+8aWl9Ee28\n q2QChL7vsxEydnYv5IBuA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:cc:content-transfer-encoding\n :content-type:date:date:feedback-id:feedback-id:from:from\n :in-reply-to:in-reply-to:message-id:mime-version:references\n :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy\n :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1694017401; x=\n 1694103801; bh=rxG68et7JQxcK2X0nZ4GmZrJdcC0SauWMLlPbucInN8=; b=P\n ADcsmdtpSBiCEbxaPhIcqp7RLutC2blKTfV9zFyX5EorokF/iNrSrIOVQCJxDpas\n uPLPZisyZmdps6VGxTdU1HLEvvgpKD7B0XMqJOd1IsM5g4uqV9iQnp5acKMK2ZJn\n fxY2kbxXTUyiebpl0glpB6kUVyDdUcoAMT1fZRe4Ar2yhrQ0/NmO/eae21jUGrP/\n Iu50kOLE65shq41+VRKkvOw1+gS7zR09iUO2rD2uZqsDDABtgnOarKkcPgy1ma6f\n 6X/CwHIBQ6YZo9BaL637UxK8UrT1rMvVn4rLKPYTmM0MmLM5ZGTHNpYoVo6de4eK\n kMoErj7suShCG6OklqG8A=="
        ],
        "X-ME-Sender": "<xms:eaf4ZGZJmhuRErI18oVLMk6oVz8GGZac8YDM-D32IcfrX4_uMG9VGQ>\n <xme:eaf4ZJYAocTl0ahqmNm24fkEn3QnMA5H2eeF4xbIXqxWZtW5PIRwpMJeyv4BvP5cE\n VF0v8wfJ_clIjhmIw>",
        "X-ME-Received": "\n <xmr:eaf4ZA9cvPTeBKOlc_-5il2fl5VPAub6r2KKdXJK4HC0JuxWRNha4giOanNzTMcAdfCtVDiisXJO1ZSRkQ47yUMw3uhPvAY>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgedviedrudehfedgleelucetufdoteggodetrfdotf\n fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen\n uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne\n cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm\n rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc\n ggtffrrghtthgvrhhnpedvjefhudeghedvtdeijeeigeetuedugfejueekieeltdfhteev\n keehhfeilefhtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfh\n hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght",
        "X-ME-Proxy": "<xmx:eaf4ZIoYoJNkIj0X893dKYR0gu73GWPOgiBNv1zgOaLVpWf7Z1Jxeg>\n <xmx:eaf4ZBozsjjVLneXK-9FdCbrmQzayWHSLyHHt9XSSirCedHexQMZdg>\n <xmx:eaf4ZGS6p2a03Jl6ul7xvH7_0mTWbQRoPJNYsWnOn33D0-erm4Dtug>\n <xmx:eaf4ZI3JQkL2RNsxepn5C9dCiE_4q-c7WSjDMd2FwNxgvi5-8LXrfw>",
        "Feedback-ID": "i47234305:Fastmail",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "Tyler Retzlaff <roretzla@linux.microsoft.com>,\n David Marchand <david.marchand@redhat.com>,\n Ferruh Yigit <ferruh.yigit@amd.com>",
        "Subject": "[PATCH 05/11] eal: force prefix for internal threads",
        "Date": "Wed,  6 Sep 2023 18:12:22 +0200",
        "Message-ID": "<20230906162226.1618088-6-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20230906162226.1618088-1-thomas@monjalon.net>",
        "References": "<20230906162226.1618088-1-thomas@monjalon.net>",
        "MIME-Version": "1.0",
        "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": "In order to make sure all threads created in DPDK drivers and libraries\nhave the same prefix in their name, some wrapper functions are added\nfor internal use when creating a control thread or setting a thread name:\n\t- rte_thread_create_internal_control\n\t- rte_thread_set_prefixed_name\n\nThe equivalent public functions are then forbidden for internal use:\n\t- rte_thread_create_control\n\t- rte_thread_set_name\n\nNote: the libraries and drivers conversion is done in next patches,\nwhile doing other thread-related changes.\n\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\n---\n devtools/checkpatches.sh           |  8 +++++\n lib/eal/common/eal_common_thread.c | 30 ++++++++++++++++\n lib/eal/include/rte_thread.h       | 57 +++++++++++++++++++++++++++++-\n lib/eal/version.map                |  2 ++\n 4 files changed, 96 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh\nindex 131ffbcebe..18ad6fbb7f 100755\n--- a/devtools/checkpatches.sh\n+++ b/devtools/checkpatches.sh\n@@ -159,6 +159,14 @@ check_forbidden_additions() { # <patch>\n \t\t-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \\\n \t\t\"$1\" || res=1\n \n+\t# forbid non-internal thread in drivers and libs\n+\tawk -v FOLDERS='lib drivers' \\\n+\t\t-v EXPRESSIONS=\"rte_thread_(set_name|create_control)\\\\\\(\" \\\n+\t\t-v RET_ON_FAIL=1 \\\n+\t\t-v MESSAGE='Prefer rte_thread_(set_prefixed_name|create_internal_control) in lib & drivers' \\\n+\t\t-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \\\n+\t\t\"$1\" || res=1\n+\n \t# forbid inclusion of driver specific headers in apps and examples\n \tawk -v FOLDERS='app examples' \\\n \t\t-v EXPRESSIONS='include.*_driver\\\\.h include.*_pmd\\\\.h' \\\ndiff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c\nindex 07ac721da1..31c37e3102 100644\n--- a/lib/eal/common/eal_common_thread.c\n+++ b/lib/eal/common/eal_common_thread.c\n@@ -392,6 +392,36 @@ rte_thread_create_control(rte_thread_t *thread, const char *name,\n \treturn ret;\n }\n \n+static void\n+add_internal_prefix(char *prefixed_name, const char *name, size_t size)\n+{\n+\tconst char *prefix = \"dpdk-\";\n+\tsize_t prefixlen;\n+\n+\tprefixlen = strlen(prefix);\n+\tstrlcpy(prefixed_name, prefix, size);\n+\tstrlcpy(prefixed_name + prefixlen, name, size - prefixlen);\n+}\n+\n+int\n+rte_thread_create_internal_control(rte_thread_t *id, const char *name,\n+\t\trte_thread_func func, void *arg)\n+{\n+\tchar prefixed_name[RTE_THREAD_NAME_SIZE];\n+\n+\tadd_internal_prefix(prefixed_name, name, sizeof(prefixed_name));\n+\treturn rte_thread_create_control(id, prefixed_name, func, arg);\n+}\n+\n+void\n+rte_thread_set_prefixed_name(rte_thread_t id, const char *name)\n+{\n+\tchar prefixed_name[RTE_THREAD_NAME_SIZE];\n+\n+\tadd_internal_prefix(prefixed_name, name, sizeof(prefixed_name));\n+\trte_thread_set_name(id, prefixed_name);\n+}\n+\n int\n rte_thread_register(void)\n {\ndiff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h\nindex dd1f62523f..4b1135df4f 100644\n--- a/lib/eal/include/rte_thread.h\n+++ b/lib/eal/include/rte_thread.h\n@@ -28,6 +28,9 @@ extern \"C\" {\n /* Old definition, aliased for compatibility. */\n #define RTE_MAX_THREAD_NAME_LEN RTE_THREAD_NAME_SIZE\n \n+/** Maximum internal thread name length (including '\\0'). */\n+#define RTE_THREAD_INTERNAL_NAME_SIZE 11\n+\n /**\n  * Thread id descriptor.\n  */\n@@ -112,7 +115,7 @@ int rte_thread_create(rte_thread_t *thread_id,\n  * @param thread_func\n  *   Function to be executed by the new thread.\n  * @param arg\n- *   Argument passed to start_routine.\n+ *   Argument passed to thread_func.\n  * @return\n  *   On success, returns 0; on error, it returns a negative value\n  *   corresponding to the error number.\n@@ -121,6 +124,36 @@ int\n rte_thread_create_control(rte_thread_t *thread, const char *name,\n \t\trte_thread_func thread_func, void *arg);\n \n+/**\n+ * Create an internal control thread.\n+ *\n+ * Creates a control thread with the given name prefixed with \"dpdk-\".\n+ * If setting the name of the thread fails, the error is ignored and logged.\n+ *\n+ * The affinity of the new thread is based on the CPU affinity retrieved\n+ * at the time rte_eal_init() was called, the EAL threads are then excluded.\n+ *\n+ * @param id\n+ *   Filled with the thread ID of the new created thread.\n+ * @param name\n+ *   The name of the control thread\n+ *   (maximum 10 characters excluding terminating '\\0').\n+ *   See RTE_THREAD_INTERNAL_NAME_SIZE.\n+ *   The name of the driver or library should be first,\n+ *   then followed by a hyphen and more details.\n+ *   It will be prefixed with \"dpdk-\" by this function.\n+ * @param func\n+ *   Function to be executed by the new thread.\n+ * @param arg\n+ *   Argument passed to func.\n+ * @return\n+ *   On success, returns 0; a negative value otherwise.\n+ */\n+__rte_internal\n+int\n+rte_thread_create_internal_control(rte_thread_t *id, const char *name,\n+\t\trte_thread_func func, void *arg);\n+\n /**\n  * Waits for the thread identified by 'thread_id' to terminate\n  *\n@@ -159,6 +192,7 @@ rte_thread_t rte_thread_self(void);\n \n /**\n  * Set the name of the thread.\n+ *\n  * This API is a noop if the underlying platform does not\n  * support setting the thread name or the platform-specific\n  * API used to set the thread name fails.\n@@ -173,6 +207,27 @@ rte_thread_t rte_thread_self(void);\n void\n rte_thread_set_name(rte_thread_t thread_id, const char *thread_name);\n \n+/**\n+ * Set the name of an internal thread with adding a \"dpdk-\" prefix.\n+ *\n+ * This API is a noop if the underlying platform does not support\n+ * setting the thread name, or if it fails.\n+ *\n+ * @param id\n+ *   The ID of the thread to set name.\n+ *\n+ * @param name\n+ *   The name to set after being prefixed\n+ *   (maximum 10 characters excluding terminating '\\0').\n+ *   See RTE_THREAD_INTERNAL_NAME_SIZE.\n+ *   The name of the driver or library should be first,\n+ *   then followed by a hyphen and more details.\n+ *   It will be prefixed with \"dpdk-\" by this function.\n+ */\n+__rte_internal\n+void\n+rte_thread_set_prefixed_name(rte_thread_t id, const char *name);\n+\n /**\n  * Check if 2 thread ids are equal.\n  *\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex 33b853d7be..6d32c19286 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -462,4 +462,6 @@ INTERNAL {\n \trte_mem_map;\n \trte_mem_page_size;\n \trte_mem_unmap;\n+\trte_thread_create_internal_control;\n+\trte_thread_set_prefixed_name;\n };\n",
    "prefixes": [
        "05/11"
    ]
}