DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
To: Zhirun Yan <zhirun.yan@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
Cc: "cunming.liang@intel.com" <cunming.liang@intel.com>,
	"haiyue.wang@intel.com" <haiyue.wang@intel.com>
Subject: RE: [EXT] [RFC, v1 4/6] graph: enhance graph walk by cross-core dispatch
Date: Thu, 8 Sep 2022 05:27:03 +0000	[thread overview]
Message-ID: <PH0PR18MB4086BAED6277AA628470E819DE409@PH0PR18MB4086.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20220908020959.1675953-5-zhirun.yan@intel.com>

> 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 <haiyue.wang@intel.com>
> Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
>  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);
> +


We should introduce a flags field in rte_graph_param which can
be used by the application to define whether a graph should support
multi-core dispatch.

Then we can make `__rte_graph_sched_wq_process` as node 0 during graph 
creation so that it will be always called at the start of graph processing followed 
by calling rest of the nodes.
This will remove unnecessary branches in fastpath.

>  	/*
>  	 * 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


  reply	other threads:[~2022-09-08  5:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  2:09 [RFC, v1 0/6] graph enhancement for multi-core dispatch Zhirun Yan
2022-09-08  2:09 ` [RFC, v1 1/6] graph: introduce core affinity API into graph Zhirun Yan
2022-09-08  2:09 ` [RFC, v1 2/6] graph: introduce graph clone API for other worker core Zhirun Yan
2022-09-08  2:09 ` [RFC, v1 3/6] graph: enable stream moving cross cores Zhirun Yan
2022-09-08  2:09 ` [RFC, v1 4/6] graph: enhance graph walk by cross-core dispatch Zhirun Yan
2022-09-08  5:27   ` Pavan Nikhilesh Bhagavatula [this message]
2022-09-15  1:52     ` [EXT] " Yan, Zhirun
2022-09-08  2:09 ` [RFC, v1 5/6] graph: add stats for corss-core dispatching Zhirun Yan
2022-09-08  2:09 ` [RFC, v1 6/6] examples: add l2fwd-graph Zhirun Yan
2022-09-20  9:33 ` [RFC, v1 0/6] graph enhancement for multi-core dispatch Jerin Jacob
2022-09-30  6:41   ` Yan, Zhirun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR18MB4086BAED6277AA628470E819DE409@PH0PR18MB4086.namprd18.prod.outlook.com \
    --to=pbhagavatula@marvell.com \
    --cc=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=haiyue.wang@intel.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=zhirun.yan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).