Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96553/?format=api
http://patchwork.dpdk.org/api/patches/96553/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1627925546-29982-3-git-send-email-navasile@linux.microsoft.com/", "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": "<1627925546-29982-3-git-send-email-navasile@linux.microsoft.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1627925546-29982-3-git-send-email-navasile@linux.microsoft.com", "date": "2021-08-02T17:32:18", "name": "[v12,02/10] eal: add thread attributes", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "ddf2fb59821729f7e2339d7737405d65a15bfc9e", "submitter": { "id": 1668, "url": "http://patchwork.dpdk.org/api/people/1668/?format=api", "name": "Narcisa Ana Maria Vasile", "email": "navasile@linux.microsoft.com" }, "delegate": null, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1627925546-29982-3-git-send-email-navasile@linux.microsoft.com/mbox/", "series": [ { "id": 18146, "url": "http://patchwork.dpdk.org/api/series/18146/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18146", "date": "2021-08-02T17:32:16", "name": "eal: Add EAL API for threading", "version": 12, "mbox": "http://patchwork.dpdk.org/series/18146/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/96553/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/96553/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 7D840A0C41;\n\tMon, 2 Aug 2021 19:32:41 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 02E9C4117A;\n\tMon, 2 Aug 2021 19:32:34 +0200 (CEST)", "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id A115E41179\n for <dev@dpdk.org>; Mon, 2 Aug 2021 19:32:31 +0200 (CEST)", "by linux.microsoft.com (Postfix, from userid 1059)\n id 0B7A220B36E0; Mon, 2 Aug 2021 10:32:31 -0700 (PDT)" ], "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 0B7A220B36E0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1627925551;\n bh=L0zaI1z1wCb2WKES5SRRJz+/IwJdoXjsAzHPDX7Bqgs=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=CX6i2QhNwbwU6z90Ye26/XhJTloejPEtaTpa3Wt9yLU5KZaEBS/oXztkX5qzVlL0C\n mN0Sd7LxSIVLiMCUf7NKUXpaBBozU9Uadf56gf9pXLKImqBo74vX/lSV328aitrLRH\n wyc6o8hiB++NdnaPW4JlgRwdKADa9KrFV2hoBBU4=", "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", "Date": "Mon, 2 Aug 2021 10:32:18 -0700", "Message-Id": "<1627925546-29982-3-git-send-email-navasile@linux.microsoft.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1627925546-29982-1-git-send-email-navasile@linux.microsoft.com>", "References": "<1627684312-28630-1-git-send-email-navasile@linux.microsoft.com>\n <1627925546-29982-1-git-send-email-navasile@linux.microsoft.com>", "Subject": "[dpdk-dev] [PATCH v12 02/10] eal: add thread attributes", "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", "Sender": "\"dev\" <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 | 93 ++++++++++++++++++++++++++++++++++++\n lib/eal/version.map | 4 ++\n lib/eal/windows/rte_thread.c | 44 +++++++++++++++++\n 4 files changed, 187 insertions(+)", "diff": "diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c\nindex 92a7451b0a..e1a4d7eae4 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\t\t rte_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\t\t rte_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\t\t enum 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 748f64d230..032ff73b36 100644\n--- a/lib/eal/include/rte_thread.h\n+++ b/lib/eal/include/rte_thread.h\n@@ -31,6 +31,30 @@ 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_UNDEFINED = 0,\n+\t/**< priority hasn't been defined */\n+\tRTE_THREAD_PRIORITY_NORMAL = 1,\n+\t/**< normal thread priority, the default */\n+\tRTE_THREAD_PRIORITY_REALTIME_CRITICAL = 2,\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 +87,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 ba7dcda664..9ffa5eb15e 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -429,6 +429,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 41c354818b..01966e7745 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\t\t rte_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\t\t rte_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\t\t enum 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": [ "v12", "02/10" ] }{ "id": 96553, "url": "