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 92B4DA0548; Thu, 8 Sep 2022 04:10:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FA3742905; Thu, 8 Sep 2022 04:10:28 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 47E60410FB for ; Thu, 8 Sep 2022 04:10:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662603026; x=1694139026; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VN6sFGxg17e17Gzy5xJdVzuuP24QUcpm4nDkS7oX7jM=; b=OUMSNiTTMIaN+Oi1Dc9N9fxbPvg2u3LUBIR2x0k084ED1nF5t+n/G1S2 IPBUgfxq1VyLbZhIcBcYk3NLNTDix+594bI9/Zu9hoUgfqcvSEWEa1Osf TvcqMTNAwJlTSmNtKhCmvgrOpg0mmh3ys2h1jKf+xvxBy92IzPZp9nKnb pkNG23gZlCw/52cJq3bGvDcNwn1KzbyKmU1ABakxavDS9ZDtTrCTcFmHD gwIS6dHBRlGYbePNsTXs2Q4Nbf3q4feLGcqVZ5+wVnAYLPChe/VpJ3pav o/kh0Ly0I8HIZtuP7ZNgbFXjl75LMoZJN0sXIF+2XEVRkgzL+2IkjW+hT w==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="383336893" X-IronPort-AV: E=Sophos;i="5.93,298,1654585200"; d="scan'208";a="383336893" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 19:10:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,298,1654585200"; d="scan'208";a="565755861" Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.118.241]) by orsmga003.jf.intel.com with ESMTP; 07 Sep 2022 19:10:23 -0700 From: Zhirun Yan To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com Cc: cunming.liang@intel.com, haiyue.wang@intel.com, Zhirun Yan Subject: [RFC, v1 4/6] graph: enhance graph walk by cross-core dispatch Date: Thu, 8 Sep 2022 10:09:57 +0800 Message-Id: <20220908020959.1675953-5-zhirun.yan@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908020959.1675953-1-zhirun.yan@intel.com> References: <20220908020959.1675953-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 enhance 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/graph.c | 6 ++++++ lib/graph/rte_graph_worker.h | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/graph/graph.c b/lib/graph/graph.c index b4eb18175a..49ea2b3fbb 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -368,6 +368,8 @@ rte_graph_destroy(rte_graph_t id) while (graph != NULL) { tmp = STAILQ_NEXT(graph, next); if (graph->id == id) { + /* Destroy the schedule work queue if has */ + graph_sched_wq_destroy(graph); /* Call fini() of the all the nodes in the graph */ graph_node_fini(graph); /* Destroy graph fast path memory */ @@ -470,6 +472,10 @@ graph_clone(struct graph *parent_graph, const char *name, if (graph_node_init(graph)) goto graph_mem_destroy; + /* Create the graph schedule work queue */ + if (graph_sched_wq_create(graph, parent_graph)) + goto graph_mem_destroy; + /* All good, Lets add the graph to the list */ graph_id++; STAILQ_INSERT_TAIL(&graph_list, graph, next); diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h index faf3f31ddc..e98697d880 100644 --- a/lib/graph/rte_graph_worker.h +++ b/lib/graph/rte_graph_worker.h @@ -177,6 +177,7 @@ static inline void rte_graph_walk(struct rte_graph *graph) { const rte_graph_off_t *cir_start = graph->cir_start; + const unsigned int lcore_id = graph->lcore_id; const rte_node_t mask = graph->cir_mask; uint32_t head = graph->head; struct rte_node *node; @@ -184,6 +185,9 @@ rte_graph_walk(struct rte_graph *graph) uint16_t rc; void **objs; + if (graph->wq != NULL) + __rte_graph_sched_wq_process(graph); + /* * Walk on the source node(s) ((cir_start - head) -> cir_start) and then * on the pending streams (cir_start -> (cir_start + mask) -> cir_start) @@ -205,6 +209,12 @@ rte_graph_walk(struct rte_graph *graph) objs = node->objs; rte_prefetch0(objs); + /* Schedule the node until all task/objs are done */ + if (node->lcore_id != RTE_MAX_LCORE && (int32_t)head > 0 && + lcore_id != node->lcore_id && graph->rq != NULL && + __rte_graph_sched_node_enqueue(node, graph->rq)) + goto next; + if (rte_graph_has_stats_feature()) { start = rte_rdtsc(); rc = node->process(graph, node, objs, node->idx); @@ -215,6 +225,7 @@ rte_graph_walk(struct rte_graph *graph) node->process(graph, node, objs, node->idx); } node->idx = 0; + next: head = likely((int32_t)head > 0) ? head & mask : head; } graph->tail = 0; -- 2.25.1