Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/46655/?format=api
https://patches.dpdk.org/api/patches/46655/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181011195753.4778-1-ferruh.yigit@intel.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": "<20181011195753.4778-1-ferruh.yigit@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20181011195753.4778-1-ferruh.yigit@intel.com", "date": "2018-10-11T19:57:52", "name": "[1/2] eal: add API that sleeps while waiting for threads", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "19cff72b2a21b26dd4e9f01331779b273e9fd0ce", "submitter": { "id": 324, "url": "https://patches.dpdk.org/api/people/324/?format=api", "name": "Ferruh Yigit", "email": "ferruh.yigit@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20181011195753.4778-1-ferruh.yigit@intel.com/mbox/", "series": [ { "id": 1850, "url": "https://patches.dpdk.org/api/series/1850/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=1850", "date": "2018-10-11T19:57:52", "name": "[1/2] eal: add API that sleeps while waiting for threads", "version": 1, "mbox": "https://patches.dpdk.org/series/1850/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/46655/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/46655/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 83D0E1B54A;\n\tThu, 11 Oct 2018 21:02:49 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 3D92B1B546\n\tfor <dev@dpdk.org>; Thu, 11 Oct 2018 21:02:48 +0200 (CEST)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Oct 2018 12:02:47 -0700", "from silpixa00399752.ir.intel.com (HELO\n\tsilpixa00399752.ger.corp.intel.com) ([10.237.222.212])\n\tby fmsmga004.fm.intel.com with ESMTP; 11 Oct 2018 11:58:08 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,369,1534834800\"; d=\"scan'208\";a=\"96723623\"", "From": "Ferruh Yigit <ferruh.yigit@intel.com>", "To": "", "Cc": "dev@dpdk.org,\n\tFerruh Yigit <ferruh.yigit@intel.com>", "Date": "Thu, 11 Oct 2018 20:57:52 +0100", "Message-Id": "<20181011195753.4778-1-ferruh.yigit@intel.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dpdk-dev] [PATCH 1/2] eal: add API that sleeps while waiting for\n\tthreads", "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://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "It is common that sample applications call rte_eal_wait_lcore() while\nwaiting for worker threads to be terminated.\nMostly master lcore keeps waiting in this function.\n\nThe waiting app for termination is not a time critical task, app can\nprefer a sleep version of the waiting to consume less cycles.\n\nA sleeping version of the API, rte_eal_wait_lcore_sleep(), has been\nadded which gets sleeping interval as parameter.\n\nSample applications will be updated later to use this API.\n\nSigned-off-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\n lib/librte_eal/common/eal_common_launch.c | 22 ++++++++++++++++++\n lib/librte_eal/common/include/rte_launch.h | 27 ++++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map | 1 +\n 3 files changed, 50 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c\nindex fe0ba3f0d..e804c70c3 100644\n--- a/lib/librte_eal/common/eal_common_launch.c\n+++ b/lib/librte_eal/common/eal_common_launch.c\n@@ -5,6 +5,7 @@\n #include <errno.h>\n #include <stdint.h>\n #include <stdio.h>\n+#include <unistd.h>\n #include <sys/queue.h>\n \n #include <rte_launch.h>\n@@ -35,6 +36,27 @@ rte_eal_wait_lcore(unsigned slave_id)\n \treturn lcore_config[slave_id].ret;\n }\n \n+/*\n+ * Wait until a lcore finished its job by sleeping.\n+ * Sleep time will be times of 'usec'\n+ */\n+int\n+rte_eal_wait_lcore_sleep(unsigned slave_id, size_t usec)\n+{\n+\tif (lcore_config[slave_id].state == WAIT)\n+\t\treturn 0;\n+\n+\twhile (lcore_config[slave_id].state != WAIT &&\n+\t lcore_config[slave_id].state != FINISHED)\n+\t\t\tusleep(usec);\n+\n+\trte_rmb();\n+\n+\t/* we are in finished state, go to wait state */\n+\tlcore_config[slave_id].state = WAIT;\n+\treturn lcore_config[slave_id].ret;\n+}\n+\n /*\n * Check that every SLAVE lcores are in WAIT state, then call\n * rte_eal_remote_launch() for all of them. If call_master is true\ndiff --git a/lib/librte_eal/common/include/rte_launch.h b/lib/librte_eal/common/include/rte_launch.h\nindex 06a671752..a935fd8b5 100644\n--- a/lib/librte_eal/common/include/rte_launch.h\n+++ b/lib/librte_eal/common/include/rte_launch.h\n@@ -11,6 +11,8 @@\n * Launch tasks on other lcores\n */\n \n+#include <rte_compat.h>\n+\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n@@ -129,6 +131,31 @@ enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned slave_id);\n */\n int rte_eal_wait_lcore(unsigned slave_id);\n \n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Wait until an lcore finishes its job.\n+ *\n+ * To be executed on the MASTER lcore only.\n+ *\n+ * Same as rte_eal_wait_lcore() but sleeps instead of busy wait.\n+ *\n+ * @param slave_id\n+ * The identifier of the lcore.\n+ * @param usec\n+ * The sleep interval in microseconds\n+ * @return\n+ * - 0: If the lcore identified by the slave_id is in a WAIT state.\n+ * - The value that was returned by the previous remote launch\n+ * function call if the lcore identified by the slave_id was in a\n+ * FINISHED or RUNNING state. In this case, it changes the state\n+ * of the lcore to WAIT.\n+ */\n+__rte_experimental int\n+rte_eal_wait_lcore_sleep(unsigned slave_id, size_t usec);\n+\n /**\n * Wait until all lcores finish their jobs.\n *\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex e968edc2e..6c636a65d 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -292,6 +292,7 @@ EXPERIMENTAL {\n \trte_devargs_remove;\n \trte_devargs_type_count;\n \trte_eal_cleanup;\n+\trte_eal_wait_lcore_sleep;\n \trte_fbarray_attach;\n \trte_fbarray_destroy;\n \trte_fbarray_detach;\n", "prefixes": [ "1/2" ] }{ "id": 46655, "url": "