From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D1C3D4281E; Fri, 24 Mar 2023 04:17:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD94D42D3B; Fri, 24 Mar 2023 04:16:56 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 231DE42D35 for ; Fri, 24 Mar 2023 04:16:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679627814; x=1711163814; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LAQ4+NhVCor84gMJvrQAQ1UH6F80izzw0qM21Lb08B8=; b=EPstcU6E+33Pnvnk7+jVtWUa/S0a5r9ImZT8nitnOWFCIm3s+xFlHkyQ yb/qk3P6+jeEtjJ3LhxGzw9Gm+ZDzqme59gvGqQ9FL5+d3q0wABvmjMth oDkVEUhyroWV9ybdnn3fraPlhSK8/RVKd3q5BZPSmqNa/dhnAx9LsIyQR OsbXU95MDtDbG8abO371zqC5PkZ8WxiszuKPEg6Kg1y5fzC+uKj77uDOY juTvBX1fDZNjMfK2ULPUtRCcN2woQDd8+60HoQ780/jDpx2S2IFxJwdjh uYSJMRYpApfON2VtlGK/oPx0vweOA/4f3qIeY3SZChUtQxkgbbIAzf2wI Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="402266471" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="402266471" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 20:16:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="684998571" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="684998571" Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.68]) by fmsmga007.fm.intel.com with ESMTP; 23 Mar 2023 20:16:51 -0700 From: Zhirun Yan To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com Cc: cunming.liang@intel.com, haiyue.wang@intel.com, Zhirun Yan Subject: [PATCH v2 11/15] graph: introduce graph walk by cross-core dispatch Date: Fri, 24 Mar 2023 11:16:18 +0900 Message-Id: <20230324021622.1369006-12-zhirun.yan@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230324021622.1369006-1-zhirun.yan@intel.com> References: <20221117050926.136974-1-zhirun.yan@intel.com> <20230324021622.1369006-1-zhirun.yan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch introduces the task scheduler mechanism to enable dispatching tasks to another worker cores. Currently, there is only a local work queue for one graph to walk. We introduce a scheduler worker queue in each worker core for dispatching tasks. It will perform the walk on scheduler work queue first, then handle the local work queue. Signed-off-by: Haiyue Wang Signed-off-by: Cunming Liang Signed-off-by: Zhirun Yan --- lib/graph/rte_graph_model_dispatch.h | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/lib/graph/rte_graph_model_dispatch.h b/lib/graph/rte_graph_model_dispatch.h index 7cbdf2fdcf..764c4ecfd0 100644 --- a/lib/graph/rte_graph_model_dispatch.h +++ b/lib/graph/rte_graph_model_dispatch.h @@ -71,6 +71,48 @@ __rte_experimental int rte_graph_model_dispatch_lcore_affinity_set(const char *name, unsigned int lcore_id); +/** + * Perform graph walk on the circular buffer and invoke the process function + * of the nodes and collect the stats. + * + * @param graph + * Graph pointer returned from rte_graph_lookup function. + * + * @see rte_graph_lookup() + */ +__rte_experimental +static inline void +rte_graph_walk_mcore_dispatch(struct rte_graph *graph) +{ + const rte_graph_off_t *cir_start = graph->cir_start; + const rte_node_t mask = graph->cir_mask; + uint32_t head = graph->head; + struct rte_node *node; + + if (graph->wq != NULL) + __rte_graph_sched_wq_process(graph); + + while (likely(head != graph->tail)) { + node = (struct rte_node *)RTE_PTR_ADD(graph, cir_start[(int32_t)head++]); + + /* skip the src nodes which not bind with current worker */ + if ((int32_t)head < 0 && node->lcore_id != graph->lcore_id) + continue; + + /* Schedule the node until all task/objs are done */ + if (node->lcore_id != RTE_MAX_LCORE && + graph->lcore_id != node->lcore_id && graph->rq != NULL && + __rte_graph_sched_node_enqueue(node, graph->rq)) + continue; + + __rte_node_process(graph, node); + + head = likely((int32_t)head > 0) ? head & mask : head; + } + + graph->tail = 0; +} + #ifdef __cplusplus } #endif -- 2.37.2