Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/104140/?format=api
https://patches.dpdk.org/api/patches/104140/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1636594425-9692-3-git-send-email-navasile@linux.microsoft.com/", "project": { "id": 1, "url": "https://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": "<1636594425-9692-3-git-send-email-navasile@linux.microsoft.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1636594425-9692-3-git-send-email-navasile@linux.microsoft.com", "date": "2021-11-11T01:33:39", "name": "[v18,2/8] eal: add thread attributes", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f411686f4c57051ae96042b8bc36125e84e47364", "submitter": { "id": 1668, "url": "https://patches.dpdk.org/api/people/1668/?format=api", "name": "Narcisa Ana Maria Vasile", "email": "navasile@linux.microsoft.com" }, "delegate": { "id": 24651, "url": "https://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1636594425-9692-3-git-send-email-navasile@linux.microsoft.com/mbox/", "series": [ { "id": 20472, "url": "https://patches.dpdk.org/api/series/20472/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=20472", "date": "2021-11-11T01:33:40", "name": "eal: Add EAL API for threading", "version": 18, "mbox": "https://patches.dpdk.org/series/20472/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/104140/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/104140/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 48837A0C4B;\n\tThu, 11 Nov 2021 02:35:15 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B072541154;\n\tThu, 11 Nov 2021 02:34:59 +0100 (CET)", "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 7B23B4113C\n for <dev@dpdk.org>; Thu, 11 Nov 2021 02:34:53 +0100 (CET)", "by linux.microsoft.com (Postfix, from userid 1059)\n id A802E20C3575; Wed, 10 Nov 2021 17:34:52 -0800 (PST)" ], "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com A802E20C3575", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1636594492;\n bh=dZLTkRTue5ZpuS8VWNjKE4iQs/9/pZf6XCY6jppnII4=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=ff03IFnfwD7cR+8ZJ13XmQmxZWPLY+cM5r9uym3YzxKcKQGoOFFMMZSPR/QJ8PtiC\n way2lNbgCx/76z3PHcPBbaGJ9RZazK9ryTWFD5wAGjrTbaWxvY/+3eYjHWpb8+F73c\n IdaTtBnQGqQeHhuo8pIGQperutXuGcPgdN+ulDgg=", "From": "Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>", "To": "dev@dpdk.org, thomas@monjalon.net, dmitry.kozliuk@gmail.com,\n khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com,\n roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com", "Cc": "bruce.richardson@intel.com, david.marchand@redhat.com,\n pallavi.kadam@intel.com", "Subject": "[PATCH v18 2/8] eal: add thread attributes", "Date": "Wed, 10 Nov 2021 17:33:39 -0800", "Message-Id": "<1636594425-9692-3-git-send-email-navasile@linux.microsoft.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1636594425-9692-1-git-send-email-navasile@linux.microsoft.com>", "References": "<1636513302-7359-1-git-send-email-navasile@linux.microsoft.com>\n <1636594425-9692-1-git-send-email-navasile@linux.microsoft.com>", "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": "From: Narcisa Vasile <navasile@microsoft.com>\n\nImplement thread attributes for:\n* thread affinity\n* thread priority\nImplement functions for managing thread attributes.\n\nPriority is represented through an enum that allows for two levels:\n\t- RTE_THREAD_PRIORITY_NORMAL\n\t- RTE_THREAD_PRIORITY_REALTIME_CRITICAL\n\nAffinity is described by the rte_cpuset_t type.\n\nAn rte_thread_attr_t object can be set to the default values\nby calling rte_thread_attr_init().\n\nSigned-off-by: Narcisa Vasile <navasile@microsoft.com>\n---\n lib/eal/common/rte_thread.c | 46 ++++++++++++++++++\n lib/eal/include/rte_thread.h | 91 ++++++++++++++++++++++++++++++++++++\n lib/eal/version.map | 4 ++\n lib/eal/windows/rte_thread.c | 44 +++++++++++++++++\n 4 files changed, 185 insertions(+)", "diff": "diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c\nindex 92a7451b0a..27ad1c7eb0 100644\n--- a/lib/eal/common/rte_thread.c\n+++ b/lib/eal/common/rte_thread.c\n@@ -9,6 +9,7 @@\n #include <string.h>\n \n #include <rte_common.h>\n+#include <rte_debug.h>\n #include <rte_errno.h>\n #include <rte_log.h>\n #include <rte_thread.h>\n@@ -33,6 +34,51 @@ rte_thread_equal(rte_thread_t t1, rte_thread_t t2)\n \treturn pthread_equal((pthread_t)t1.opaque_id, (pthread_t)t2.opaque_id);\n }\n \n+int\n+rte_thread_attr_init(rte_thread_attr_t *attr)\n+{\n+\tRTE_VERIFY(attr != NULL);\n+\n+\tCPU_ZERO(&attr->cpuset);\n+\tattr->priority = RTE_THREAD_PRIORITY_NORMAL;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr,\n+\t\trte_cpuset_t *cpuset)\n+{\n+\tRTE_VERIFY(thread_attr != NULL);\n+\tRTE_VERIFY(cpuset != NULL);\n+\n+\tthread_attr->cpuset = *cpuset;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr,\n+\t\trte_cpuset_t *cpuset)\n+{\n+\tRTE_VERIFY(thread_attr != NULL);\n+\tRTE_VERIFY(cpuset != NULL);\n+\n+\t*cpuset = thread_attr->cpuset;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr,\n+\t\tenum rte_thread_priority priority)\n+{\n+\tRTE_VERIFY(thread_attr != NULL);\n+\n+\tthread_attr->priority = priority;\n+\treturn 0;\n+}\n+\n int\n rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))\n {\ndiff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h\nindex c9cdeb07aa..8a20215a94 100644\n--- a/lib/eal/include/rte_thread.h\n+++ b/lib/eal/include/rte_thread.h\n@@ -31,6 +31,28 @@ typedef struct rte_thread_tag {\n \tuintptr_t opaque_id; /**< thread identifier */\n } rte_thread_t;\n \n+/**\n+ * Thread priority values.\n+ */\n+enum rte_thread_priority {\n+\tRTE_THREAD_PRIORITY_NORMAL = 0,\n+\t/**< normal thread priority, the default */\n+\tRTE_THREAD_PRIORITY_REALTIME_CRITICAL = 1,\n+\t/**< highest thread priority allowed */\n+};\n+\n+#ifdef RTE_HAS_CPUSET\n+\n+/**\n+ * Representation for thread attributes.\n+ */\n+typedef struct {\n+\tenum rte_thread_priority priority; /**< thread priority */\n+\trte_cpuset_t cpuset; /**< thread affinity */\n+} rte_thread_attr_t;\n+\n+#endif /* RTE_HAS_CPUSET */\n+\n /**\n * TLS key type, an opaque pointer.\n */\n@@ -63,6 +85,75 @@ int rte_thread_equal(rte_thread_t t1, rte_thread_t t2);\n \n #ifdef RTE_HAS_CPUSET\n \n+/**\n+ * Initialize the attributes of a thread.\n+ * These attributes can be passed to the rte_thread_create() function\n+ * that will create a new thread and set its attributes according to attr.\n+ *\n+ * @param attr\n+ * Thread attributes to initialize.\n+ *\n+ * @return\n+ * On success, return 0.\n+ * On failure, return a positive errno-style error number.\n+ */\n+__rte_experimental\n+int rte_thread_attr_init(rte_thread_attr_t *attr);\n+\n+/**\n+ * Set the CPU affinity value in the thread attributes pointed to\n+ * by 'thread_attr'.\n+ *\n+ * @param thread_attr\n+ * Points to the thread attributes in which affinity will be updated.\n+ *\n+ * @param cpuset\n+ * Points to the value of the affinity to be set.\n+ *\n+ * @return\n+ * On success, return 0.\n+ * On failure, return a positive errno-style error number.\n+ */\n+__rte_experimental\n+int rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr,\n+\t\trte_cpuset_t *cpuset);\n+\n+/**\n+ * Get the value of CPU affinity that is set in the thread attributes pointed\n+ * to by 'thread_attr'.\n+ *\n+ * @param thread_attr\n+ * Points to the thread attributes from which affinity will be retrieved.\n+ *\n+ * @param cpuset\n+ * Pointer to the memory that will store the affinity.\n+ *\n+ * @return\n+ * On success, return 0.\n+ * On failure, return a positive errno-style error number.\n+ */\n+__rte_experimental\n+int rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr,\n+\t\trte_cpuset_t *cpuset);\n+\n+/**\n+ * Set the thread priority value in the thread attributes pointed to\n+ * by 'thread_attr'.\n+ *\n+ * @param thread_attr\n+ * Points to the thread attributes in which priority will be updated.\n+ *\n+ * @param priority\n+ * Points to the value of the priority to be set.\n+ *\n+ * @return\n+ * On success, return 0.\n+ * On failure, return a positive errno-style error number.\n+ */\n+__rte_experimental\n+int rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr,\n+\t\tenum rte_thread_priority priority);\n+\n /**\n * Set core affinity of the current thread.\n * Support both EAL and non-EAL thread and update TLS.\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex 24e9747795..3fc33fcd70 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -423,6 +423,10 @@ EXPERIMENTAL {\n \n \trte_thread_self;\n \trte_thread_equal;\n+\trte_thread_attr_init;\n+\trte_thread_attr_get_affinity;\n+\trte_thread_attr_set_affinity;\n+\trte_thread_attr_set_priority;\n };\n \n INTERNAL {\ndiff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c\nindex 26c8dd4ebe..f65919f46d 100644\n--- a/lib/eal/windows/rte_thread.c\n+++ b/lib/eal/windows/rte_thread.c\n@@ -4,6 +4,7 @@\n */\n \n #include <rte_common.h>\n+#include <rte_debug.h>\n #include <rte_errno.h>\n #include <rte_thread.h>\n #include <rte_windows.h>\n@@ -28,6 +29,49 @@ rte_thread_equal(rte_thread_t t1, rte_thread_t t2)\n \treturn t1.opaque_id == t2.opaque_id;\n }\n \n+int\n+rte_thread_attr_init(rte_thread_attr_t *attr)\n+{\n+\tRTE_VERIFY(attr != NULL);\n+\n+\tattr->priority = RTE_THREAD_PRIORITY_NORMAL;\n+\tCPU_ZERO(&attr->cpuset);\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr,\n+\t\trte_cpuset_t *cpuset)\n+{\n+\tRTE_VERIFY(thread_attr != NULL);\n+\tthread_attr->cpuset = *cpuset;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr,\n+\t\trte_cpuset_t *cpuset)\n+{\n+\tRTE_VERIFY(thread_attr != NULL);\n+\n+\t*cpuset = thread_attr->cpuset;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr,\n+\t\tenum rte_thread_priority priority)\n+{\n+\tRTE_VERIFY(thread_attr != NULL);\n+\n+\tthread_attr->priority = priority;\n+\n+\treturn 0;\n+}\n+\n int\n rte_thread_key_create(rte_thread_key *key,\n \t\t__rte_unused void (*destructor)(void *))\n", "prefixes": [ "v18", "2/8" ] }{ "id": 104140, "url": "