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 5D17342CAB; Tue, 13 Jun 2023 16:13:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76CFC42D6D; Tue, 13 Jun 2023 16:12:38 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id AA8ED42D61 for ; Tue, 13 Jun 2023 16:12:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686665556; x=1718201556; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mr9iwvNxhZ7hGShL923CB2ZRxK/tbZrY7A7RG2Y8TbA=; b=EKVZrLtGMPqf1tQO09psjD/QWQGtGaTx8rLBmLh3eOl407RWfVclPPfv 3o6z0pXPvyuKav2n6LJo3/5HAo8RsKyWWQIXzPSwiVRWnOXwRoan+migT 9UEGOrNqlTIoARGwh/No2i1eYt/hBznOc8o1ngl/aLSzNUuYozjDlPHzf 7LKGFMQT/9j0O1p2Ny/jYOacf0UvrklDYc3S4PDHbKesgQtfxcxGX3x/L 4kHCg/dDbnWdFFuxx6Yc8bQv/WPGtcF4gVUeTmXBoS2pHx9Xm2HwJ2cLE tsLpgO8YtMDObF1cION17hcmC1KTveFwoIinjFCvuyl5fZ5RcX6Rg2Kpz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="355839880" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="355839880" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 07:12:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="741439416" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="741439416" Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.94]) by orsmga008.jf.intel.com with ESMTP; 13 Jun 2023 07:12:33 -0700 From: Zhirun Yan To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, stephen@networkplumber.org, pbhagavatula@marvell.com, jerinjacobk@gmail.com, david.marchand@redhat.com Cc: cunming.liang@intel.com, haiyue.wang@intel.com, mattias.ronnblom@ericsson.com, Zhirun Yan Subject: [PATCH v14 12/16] graph: introduce graph walk by cross-core dispatch Date: Tue, 13 Jun 2023 22:04:41 +0800 Message-Id: <20230613140445.2155542-13-zhirun.yan@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230613140445.2155542-1-zhirun.yan@intel.com> References: <20230613101404.1787790-1-zhirun.yan@intel.com> <20230613140445.2155542-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 Acked-by: Jerin Jacob Acked-by: Pavan Nikhilesh --- lib/graph/rte_graph_model_mcore_dispatch.h | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/lib/graph/rte_graph_model_mcore_dispatch.h b/lib/graph/rte_graph_model_mcore_dispatch.h index 6163f96c37..c78a3bbdf9 100644 --- a/lib/graph/rte_graph_model_mcore_dispatch.h +++ b/lib/graph/rte_graph_model_mcore_dispatch.h @@ -83,6 +83,50 @@ __rte_experimental int rte_graph_model_mcore_dispatch_node_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; + + RTE_ASSERT(graph->parent_id != RTE_GRAPH_ID_INVALID); + if (graph->dispatch.wq != NULL) + __rte_graph_mcore_dispatch_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->dispatch.lcore_id != graph->dispatch.lcore_id) + continue; + + /* Schedule the node until all task/objs are done */ + if (node->dispatch.lcore_id != RTE_MAX_LCORE && + graph->dispatch.lcore_id != node->dispatch.lcore_id && + graph->dispatch.rq != NULL && + __rte_graph_mcore_dispatch_sched_node_enqueue(node, graph->dispatch.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