Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/36425/?format=api
http://patches.dpdk.org/api/patches/36425/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/9ff09ae09b3e9e1b149f73a693b552f8c94a01a2.1521722141.git.anatoly.burakov@intel.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": "<9ff09ae09b3e9e1b149f73a693b552f8c94a01a2.1521722141.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/9ff09ae09b3e9e1b149f73a693b552f8c94a01a2.1521722141.git.anatoly.burakov@intel.com", "date": "2018-03-22T12:36:04", "name": "[dpdk-dev,v6] eal: provide API for querying valid socket id's", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "cf7e03c3e915bdaa851c26e1e5627373e5455dbe", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.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/9ff09ae09b3e9e1b149f73a693b552f8c94a01a2.1521722141.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/36425/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/36425/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8A99F4CBD;\n\tThu, 22 Mar 2018 13:36:10 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 6B9674CBB\n\tfor <dev@dpdk.org>; Thu, 22 Mar 2018 13:36:08 +0100 (CET)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t22 Mar 2018 05:36:07 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga001.jf.intel.com with ESMTP; 22 Mar 2018 05:36:05 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw2MCa4ai000540; Thu, 22 Mar 2018 12:36:04 GMT", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w2MCa4bD029483;\n\tThu, 22 Mar 2018 12:36:04 GMT", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w2MCa4q4029462;\n\tThu, 22 Mar 2018 12:36:04 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.48,344,1517904000\"; d=\"scan'208\";a=\"41238534\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "Bruce Richardson <bruce.richardson@intel.com>, thomas@monjalon.net,\n\tchaozhu@linux.vnet.ibm.com, gowrishankar.m@linux.vnet.ibm.com", "Date": "Thu, 22 Mar 2018 12:36:04 +0000", "Message-Id": "<9ff09ae09b3e9e1b149f73a693b552f8c94a01a2.1521722141.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": "<9755302ee8a1439a152408d4b1c69cc1012153e4.1521715978.git.anatoly.burakov@intel.com>", "References": "<9755302ee8a1439a152408d4b1c69cc1012153e4.1521715978.git.anatoly.burakov@intel.com>", "Subject": "[dpdk-dev] [PATCH v6] eal: provide API for querying valid socket\n\tid's", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "During lcore scan, find all socket ID's and store them, and\nprovide public API to query valid socket id's. This will break\nthe ABI, so bump ABI version.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n v6:\n - Fixed meson ABI version header\n \n v5:\n - Move API to experimental\n - Store list of valid socket id's instead of simply\n recording the biggest one\n \n v4:\n - Remove backwards ABI compatibility, bump ABI instead\n \n v3:\n - Added ABI compatibility\n \n v2:\n - checkpatch changes\n - check socket before deciding if the core is not to be used\n\n lib/librte_eal/bsdapp/eal/Makefile | 2 +-\n lib/librte_eal/common/eal_common_lcore.c | 75 ++++++++++++++++++++++++++-----\n lib/librte_eal/common/include/rte_eal.h | 3 ++\n lib/librte_eal/common/include/rte_lcore.h | 30 +++++++++++++\n lib/librte_eal/linuxapp/eal/Makefile | 2 +-\n lib/librte_eal/meson.build | 2 +-\n lib/librte_eal/rte_eal_version.map | 2 +\n 7 files changed, 101 insertions(+), 15 deletions(-)", "diff": "diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex dd455e6..ed1d17b 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -21,7 +21,7 @@ LDLIBS += -lgcc_s\n \n EXPORT_MAP := ../../rte_eal_version.map\n \n-LIBABIVER := 6\n+LIBABIVER := 7\n \n # specific to bsdapp exec-env\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c\ndiff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c\nindex 7724fa4..50d9f82 100644\n--- a/lib/librte_eal/common/eal_common_lcore.c\n+++ b/lib/librte_eal/common/eal_common_lcore.c\n@@ -7,6 +7,7 @@\n #include <string.h>\n #include <dirent.h>\n \n+#include <rte_errno.h>\n #include <rte_log.h>\n #include <rte_eal.h>\n #include <rte_lcore.h>\n@@ -16,6 +17,19 @@\n #include \"eal_private.h\"\n #include \"eal_thread.h\"\n \n+static int\n+socket_id_cmp(const void *a, const void *b)\n+{\n+\tconst int *lcore_id_a = a;\n+\tconst int *lcore_id_b = b;\n+\n+\tif (*lcore_id_a < *lcore_id_b)\n+\t\treturn -1;\n+\tif (*lcore_id_a > *lcore_id_b)\n+\t\treturn 1;\n+\treturn 0;\n+}\n+\n /*\n * Parse /sys/devices/system/cpu to get the number of physical and logical\n * processors on the machine. The function will fill the cpu_info\n@@ -28,6 +42,8 @@ rte_eal_cpu_init(void)\n \tstruct rte_config *config = rte_eal_get_configuration();\n \tunsigned lcore_id;\n \tunsigned count = 0;\n+\tunsigned int socket_id, prev_socket_id;\n+\tint lcore_to_socket_id[RTE_MAX_LCORE];\n \n \t/*\n \t * Parse the maximum set of logical cores, detect the subset of running\n@@ -39,6 +55,19 @@ rte_eal_cpu_init(void)\n \t\t/* init cpuset for per lcore config */\n \t\tCPU_ZERO(&lcore_config[lcore_id].cpuset);\n \n+\t\t/* find socket first */\n+\t\tsocket_id = eal_cpu_socket_id(lcore_id);\n+\t\tif (socket_id >= RTE_MAX_NUMA_NODES) {\n+#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID\n+\t\t\tsocket_id = 0;\n+#else\n+\t\t\tRTE_LOG(ERR, EAL, \"Socket ID (%u) is greater than RTE_MAX_NUMA_NODES (%d)\\n\",\n+\t\t\t\t\tsocket_id, RTE_MAX_NUMA_NODES);\n+\t\t\treturn -1;\n+#endif\n+\t\t}\n+\t\tlcore_to_socket_id[lcore_id] = socket_id;\n+\n \t\t/* in 1:1 mapping, record related cpu detected state */\n \t\tlcore_config[lcore_id].detected = eal_cpu_detected(lcore_id);\n \t\tif (lcore_config[lcore_id].detected == 0) {\n@@ -54,18 +83,7 @@ rte_eal_cpu_init(void)\n \t\tconfig->lcore_role[lcore_id] = ROLE_RTE;\n \t\tlcore_config[lcore_id].core_role = ROLE_RTE;\n \t\tlcore_config[lcore_id].core_id = eal_cpu_core_id(lcore_id);\n-\t\tlcore_config[lcore_id].socket_id = eal_cpu_socket_id(lcore_id);\n-\t\tif (lcore_config[lcore_id].socket_id >= RTE_MAX_NUMA_NODES) {\n-#ifdef RTE_EAL_ALLOW_INV_SOCKET_ID\n-\t\t\tlcore_config[lcore_id].socket_id = 0;\n-#else\n-\t\t\tRTE_LOG(ERR, EAL, \"Socket ID (%u) is greater than \"\n-\t\t\t\t\"RTE_MAX_NUMA_NODES (%d)\\n\",\n-\t\t\t\tlcore_config[lcore_id].socket_id,\n-\t\t\t\tRTE_MAX_NUMA_NODES);\n-\t\t\treturn -1;\n-#endif\n-\t\t}\n+\t\tlcore_config[lcore_id].socket_id = socket_id;\n \t\tRTE_LOG(DEBUG, EAL, \"Detected lcore %u as \"\n \t\t\t\t\"core %u on socket %u\\n\",\n \t\t\t\tlcore_id, lcore_config[lcore_id].core_id,\n@@ -79,5 +97,38 @@ rte_eal_cpu_init(void)\n \t\tRTE_MAX_LCORE);\n \tRTE_LOG(INFO, EAL, \"Detected %u lcore(s)\\n\", config->lcore_count);\n \n+\t/* sort all socket id's in ascending order */\n+\tqsort(lcore_to_socket_id, RTE_DIM(lcore_to_socket_id),\n+\t\t\tsizeof(lcore_to_socket_id[0]), socket_id_cmp);\n+\n+\tprev_socket_id = -1;\n+\tconfig->numa_node_count = 0;\n+\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n+\t\tsocket_id = lcore_to_socket_id[lcore_id];\n+\t\tif (socket_id != prev_socket_id)\n+\t\t\tconfig->numa_nodes[config->numa_node_count++] =\n+\t\t\t\t\tsocket_id;\n+\t\tprev_socket_id = socket_id;\n+\t}\n+\tRTE_LOG(INFO, EAL, \"Detected %u NUMA nodes\\n\", config->numa_node_count);\n+\n \treturn 0;\n }\n+\n+unsigned int __rte_experimental\n+rte_num_socket_ids(void)\n+{\n+\tconst struct rte_config *config = rte_eal_get_configuration();\n+\treturn config->numa_node_count;\n+}\n+\n+int __rte_experimental\n+rte_socket_id_by_idx(unsigned int idx)\n+{\n+\tconst struct rte_config *config = rte_eal_get_configuration();\n+\tif (idx >= config->numa_node_count) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\treturn config->numa_nodes[idx];\n+}\ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 93ca4cc..6109472 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -57,6 +57,9 @@ enum rte_proc_type_t {\n struct rte_config {\n \tuint32_t master_lcore; /**< Id of the master lcore */\n \tuint32_t lcore_count; /**< Number of available logical cores. */\n+\tuint32_t numa_node_count; /**< Number of detected NUMA nodes. */\n+\tuint32_t numa_nodes[RTE_MAX_NUMA_NODES];\n+\t/**< List of detected numa nodes. */\n \tuint32_t service_lcore_count;/**< Number of available service cores. */\n \tenum rte_lcore_role_t lcore_role[RTE_MAX_LCORE]; /**< State of cores. */\n \ndiff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h\nindex 0472220..c6511a9 100644\n--- a/lib/librte_eal/common/include/rte_lcore.h\n+++ b/lib/librte_eal/common/include/rte_lcore.h\n@@ -132,6 +132,36 @@ rte_lcore_index(int lcore_id)\n unsigned rte_socket_id(void);\n \n /**\n+ * Return number of physical sockets detected on the system.\n+ *\n+ * Note that number of nodes may not be correspondent to their physical id's:\n+ * for example, a system may report two socket id's, but the actual socket id's\n+ * may be 0 and 8.\n+ *\n+ * @return\n+ * the number of physical sockets as recognized by EAL\n+ */\n+unsigned int __rte_experimental\n+rte_num_socket_ids(void);\n+\n+/**\n+ * Return socket id with a particular index.\n+ *\n+ * This will return socket id at a particular position in list of all detected\n+ * physical socket id's. For example, on a machine with sockets [0, 8], passing\n+ * 1 as a parameter will return 8.\n+ *\n+ * @param idx\n+ * index of physical socket id to return\n+ *\n+ * @return\n+ * - physical socket id as recognized by EAL\n+ * - -1 on error, with errno set to EINVAL\n+ */\n+int __rte_experimental\n+rte_socket_id_by_idx(unsigned int idx);\n+\n+/**\n * Get the ID of the physical socket of the specified lcore\n *\n * @param lcore_id\ndiff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex 7e5bbe8..b9c7727 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -10,7 +10,7 @@ ARCH_DIR ?= $(RTE_ARCH)\n EXPORT_MAP := ../../rte_eal_version.map\n VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)\n \n-LIBABIVER := 6\n+LIBABIVER := 7\n \n VPATH += $(RTE_SDK)/lib/librte_eal/common\n \ndiff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build\nindex d9ba385..8f0ce1b 100644\n--- a/lib/librte_eal/meson.build\n+++ b/lib/librte_eal/meson.build\n@@ -43,7 +43,7 @@ else\n \terror('unsupported system type @0@'.format(hostmachine.system()))\n endif\n \n-version = 6 # the version of the EAL API\n+version = 7 # the version of the EAL API\n allow_experimental_apis = true\n deps += 'compat'\n cflags += '-D_GNU_SOURCE'\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 1d88437..6a4c355 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -229,6 +229,8 @@ EXPERIMENTAL {\n \trte_mp_request;\n \trte_mp_request_async;\n \trte_mp_reply;\n+\trte_num_socket_ids;\n+\trte_socket_id_by_idx;\n \trte_service_attr_get;\n \trte_service_attr_reset_all;\n \trte_service_component_register;\n", "prefixes": [ "dpdk-dev", "v6" ] }{ "id": 36425, "url": "