Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/27814/?format=api
https://patches.dpdk.org/api/patches/27814/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1503499644-29432-3-git-send-email-erik.g.carrillo@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": "<1503499644-29432-3-git-send-email-erik.g.carrillo@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1503499644-29432-3-git-send-email-erik.g.carrillo@intel.com", "date": "2017-08-23T14:47:23", "name": "[dpdk-dev,2/3] timer: handle timers installed from non-EAL threads", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2de590d636f3f357938c7cd5c658f88df7a36e12", "submitter": { "id": 762, "url": "https://patches.dpdk.org/api/people/762/?format=api", "name": "Carrillo, Erik G", "email": "erik.g.carrillo@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1503499644-29432-3-git-send-email-erik.g.carrillo@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/27814/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/27814/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 9B04F7D6F;\n\tWed, 23 Aug 2017 16:47:45 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id D1F3A7D67\n\tfor <dev@dpdk.org>; Wed, 23 Aug 2017 16:47:44 +0200 (CEST)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Aug 2017 07:47:44 -0700", "from txasoft-yocto.an.intel.com (HELO txasoft-yocto.an.intel.com.)\n\t([10.123.72.111])\n\tby orsmga002.jf.intel.com with ESMTP; 23 Aug 2017 07:47:44 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.41,417,1498546800\"; d=\"scan'208\";a=\"127405118\"", "From": "Gabriel Carrillo <erik.g.carrillo@intel.com>", "To": "rsanford@akamai.com", "Cc": "dev@dpdk.org", "Date": "Wed, 23 Aug 2017 09:47:23 -0500", "Message-Id": "<1503499644-29432-3-git-send-email-erik.g.carrillo@intel.com>", "X-Mailer": "git-send-email 1.7.10", "In-Reply-To": "<1503499644-29432-1-git-send-email-erik.g.carrillo@intel.com>", "References": "<1503499644-29432-1-git-send-email-erik.g.carrillo@intel.com>", "Subject": "[dpdk-dev] [PATCH 2/3] timer: handle timers installed from non-EAL\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": "<http://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": "<http://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": "This commit adds support for timers being created from\nnon-EAL threads; it maps timers from all such threads to\nlcore id RTE_MAX_LCORE, and puts them all in a corresponding\nskiplist.\n\nSigned-off-by: Gabriel Carrillo <erik.g.carrillo@intel.com>\n---\n lib/librte_timer/rte_timer.c | 48 ++++++++++++++++++++++++++++++--------------\n 1 file changed, 33 insertions(+), 15 deletions(-)", "diff": "diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c\nindex 2db74c1..a493874 100644\n--- a/lib/librte_timer/rte_timer.c\n+++ b/lib/librte_timer/rte_timer.c\n@@ -64,8 +64,8 @@ struct skiplist {\n } __rte_cache_aligned;\n \n struct priv_timer {\n-\t/** one pending list per enabled lcore */\n-\tstruct skiplist pending_lists[RTE_MAX_LCORE];\n+\t/** one pending list per lcore, plus one for non-EAL threads */\n+\tstruct skiplist pending_lists[RTE_MAX_LCORE + 1];\n \n \t/** per-core variable that true if a timer was updated on this\n \t * core since last reset of the variable */\n@@ -85,7 +85,7 @@ struct priv_timer {\n static struct priv_timer priv_timer[RTE_MAX_LCORE];\n \n /** cache of IDs of enabled lcores */\n-static unsigned enabled_lcores[RTE_MAX_LCORE];\n+static unsigned enabled_lcores[RTE_MAX_LCORE + 1];\n static int n_enabled_lcores;\n \n /* when debug is enabled, store some statistics */\n@@ -103,23 +103,33 @@ static int n_enabled_lcores;\n void\n rte_timer_subsystem_init(void)\n {\n-\tunsigned lcore_id1, lcore_id2;\n+\tunsigned target_lcore, installer_lcore;\n \tstruct skiplist *list;\n+\tstruct priv_timer *priv_tim;\n \tint i, j;\n \n-\tRTE_LCORE_FOREACH(lcore_id1)\n-\t\tenabled_lcores[n_enabled_lcores++] = lcore_id1;\n+\tRTE_LCORE_FOREACH(target_lcore)\n+\t\tenabled_lcores[n_enabled_lcores++] = target_lcore;\n+\n+\t/* To handle timers coming from non-EAL threads */\n+\tenabled_lcores[n_enabled_lcores++] = RTE_MAX_LCORE;\n \n \t/* since priv_timer is static, it's zeroed by default, so only init some\n \t * fields.\n \t */\n-\tfor (i = 0, lcore_id1 = enabled_lcores[i]; i < n_enabled_lcores;\n-\t lcore_id1 = enabled_lcores[++i]) {\n-\t\tpriv_timer[lcore_id1].prev_lcore = lcore_id1;\n+\tfor (i = 0, target_lcore = enabled_lcores[i]; i < n_enabled_lcores;\n+\t target_lcore = enabled_lcores[++i]) {\n+\t\t/* Don't use this value to index the priv_timer array */\n+\t\tif (target_lcore == RTE_MAX_LCORE)\n+\t\t\tcontinue;\n \n-\t\tfor (j = 0, lcore_id2 = enabled_lcores[j]; j < n_enabled_lcores;\n-\t\t lcore_id2 = enabled_lcores[++j]) {\n-\t\t\tlist = &priv_timer[lcore_id1].pending_lists[lcore_id2];\n+\t\tpriv_tim = &priv_timer[target_lcore];\n+\t\tpriv_tim->prev_lcore = target_lcore;\n+\n+\t\tfor (j = 0, installer_lcore = enabled_lcores[j];\n+\t\t j < n_enabled_lcores;\n+\t\t installer_lcore = enabled_lcores[++j]) {\n+\t\t\tlist = &priv_tim->pending_lists[installer_lcore];\n \t\t\trte_spinlock_init(&list->lock);\n \t\t}\n \t}\n@@ -300,10 +310,16 @@ timer_get_prev_entries_for_node(struct rte_timer *tim, struct skiplist *list,\n static void\n timer_add(struct rte_timer *tim, unsigned tim_lcore, int local_is_locked)\n {\n-\tunsigned lcore_id = rte_lcore_id();\n+\tunsigned installer_lcore, lcore_id = rte_lcore_id();\n \tunsigned lvl;\n \tstruct rte_timer *prev[MAX_SKIPLIST_DEPTH+1];\n-\tstruct skiplist *list = &priv_timer[tim_lcore].pending_lists[lcore_id];\n+\tstruct skiplist *list;\n+\n+\t/* Check if timer being installed from non-EAL thread */\n+\tinstaller_lcore = (lcore_id == LCORE_ID_ANY) ? RTE_MAX_LCORE :\n+\t\tlcore_id;\n+\n+\tlist = &priv_timer[tim_lcore].pending_lists[installer_lcore];\n \n \t/* if timer needs to be scheduled on another core, we need to\n \t * lock the list; if it is on local core, we need to lock if\n@@ -439,7 +455,9 @@ __rte_timer_reset(struct rte_timer *tim, uint64_t expire,\n \t * the state so we don't need to use cmpset() here */\n \trte_wmb();\n \tstatus.state = RTE_TIMER_PENDING;\n-\tstatus.installer = lcore_id;\n+\t/* Check if installer is non-EAL thread */\n+\tstatus.installer = (lcore_id == LCORE_ID_ANY) ? RTE_MAX_LCORE :\n+\t\t\t lcore_id;\n \tstatus.owner = tim_lcore;\n \ttim->status.u32 = status.u32;\n \n", "prefixes": [ "dpdk-dev", "2/3" ] }{ "id": 27814, "url": "