Skip to contentSkip to conversation

test/graph: fix graph autotest second test failure

PATCH In review Huichao cai 2 participants 8 messages Oct 22, 2024 – Oct 28, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/graph: fix graph autotest second test failure

Start dpdk-test, execute the graph_autotest test command for the first time, the result is successful, and then test again, the result is always failing, modify this problem to make this test command idempotent.

---
 app/test/test_graph.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
app/test/test_graph.c +12 -9
index 2840a25..16a1a90 100644
@@ -552,7 +552,7 @@ struct test_node_register {
 	tm->test_node[0].idx = node_id;
 
 	dummy_id = rte_node_clone(node_id, "test_node00");
-	if (rte_node_is_invalid(dummy_id)) {
+	if (rte_node_is_invalid(dummy_id) && (rte_errno != EEXIST)) {
 		printf("Got invalid id when clone, Expecting fail\n");
 		return -1;
 	}
@@ -565,12 +565,14 @@ struct test_node_register {
 	}
 
 	for (i = 1; i < MAX_NODES; i++) {
-		tm->test_node[i].idx =
-			rte_node_clone(node_id, tm->test_node[i].node.name);
-		if (rte_node_is_invalid(tm->test_node[i].idx)) {
+		dummy_id = rte_node_clone(node_id, tm->test_node[i].node.name);
+		if (rte_node_is_invalid(dummy_id) && (rte_errno != EEXIST)) {
 			printf("Got invalid node id\n");
 			return -1;
 		}
+
+		if (!rte_node_is_invalid(dummy_id))
+			tm->test_node[i].idx = dummy_id;
 	}
 
 	/* Clone from cloned node should fail */
@@ -640,7 +642,7 @@ struct test_node_register {
 
 	node_id = rte_node_from_name("test_node00");
 	dummy_node_id = rte_node_clone(node_id, "dummy_node");
-	if (rte_node_is_invalid(dummy_node_id)) {
+	if (rte_node_is_invalid(dummy_node_id) && (rte_errno != EEXIST)) {
 		printf("Got invalid node id\n");
 		return -1;
 	}
@@ -672,7 +674,7 @@ struct test_node_register {
 	main_graph_id = rte_graph_from_name("worker0");
 	if (main_graph_id == RTE_GRAPH_ID_INVALID) {
 		printf("Must create main graph first\n");
-		ret = -1;
+		return -1;
 	}
 
 	graph_conf.dispatch.mp_capacity = 1024;
@@ -682,7 +684,7 @@ struct test_node_register {
 
 	if (cloned_graph_id == RTE_GRAPH_ID_INVALID) {
 		printf("Graph creation failed with error = %d\n", rte_errno);
-		ret = -1;
+		return -1;
 	}
 
 	if (strcmp(rte_graph_id_to_name(cloned_graph_id), "worker0-cloned-test0")) {
@@ -787,7 +789,7 @@ struct test_node_register {
 	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test1", &graph_conf);
 	node = rte_graph_node_get(cloned_graph_id, nid);
 
-	if (node->dispatch.lcore_id != worker_lcore) {
+	if (!node || node->dispatch.lcore_id != worker_lcore) {
 		printf("set node affinity failed\n");
 		ret = -1;
 	}
@@ -859,7 +861,8 @@ struct test_node_register {
 	}
 
 	graph = rte_graph_lookup("worker0-cloned-test3");
-	if (rte_graph_worker_model_get(graph) != RTE_GRAPH_MODEL_MCORE_DISPATCH) {
+	if (!graph || rte_graph_worker_model_get(graph) !=
+		    RTE_GRAPH_MODEL_MCORE_DISPATCH) {
 		printf("Get graph worker model failed\n");
 		ret = -1;
 	}
Signature · 1 line
1.8.3.1
#1 lore raw

From: Huichao cai <[email protected]>
Sent: Tuesday, October 22, 2024 4:58 PM
To: Jerin Jacob <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; [email protected]
Cc: [email protected]
Subject: [EXTERNAL] [PATCH] test/graph: fix graph autotest second test failure

Start dpdk-test, execute the graph_autotest test command for the first time, the result is successful, and then test again, the result is always failing, modify this problem to make this test command idempotent. Signed-off-by: Huichao cai <chcchc88@ 163. com>

Start dpdk-test, execute the graph_autotest test command for

the first time, the result is successful, and then test again,

the result is always failing, modify this problem to make this

test command idempotent.

---

 app/test/test_graph.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
app/test/test_graph.c +0 -0

index 2840a25..16a1a90 100644

--- a/app/test/test_graph.c

+++ b/app/test/test_graph.c

@@ -552,7 +552,7 @@ struct test_node_register {

              tm->test_node[0].idx = node_id;



              dummy_id = rte_node_clone(node_id, "test_node00");

- if (rte_node_is_invalid(dummy_id)) {

+ if (rte_node_is_invalid(dummy_id) && (rte_errno != EEXIST)) {

                             printf("Got invalid id when clone, Expecting fail\n");

                             return -1;

              }

I think cloned nodes are not being added to any graph, so, not being freed. So, we are seeing this issue.

Instead of suppressing the errors, could you create a dummy graph and add the nodes to graph and call graph destroy.

This will free the cloned nodes and we don’t see this problem.

@@ -565,12 +565,14 @@ struct test_node_register {

              }



              for (i = 1; i < MAX_NODES; i++) {

- tm->test_node[i].idx =

- rte_node_clone(node_id, tm->test_node[i].node.name);

- if (rte_node_is_invalid(tm->test_node[i].idx)) {

+ dummy_id = rte_node_clone(node_id, tm->test_node[i].node.name);

+ if (rte_node_is_invalid(dummy_id) && (rte_errno != EEXIST)) {

                                            printf("Got invalid node id\n");

                                            return -1;

                             }

+

+ if (!rte_node_is_invalid(dummy_id))

+ tm->test_node[i].idx = dummy_id;

              }



              /* Clone from cloned node should fail */

@@ -640,7 +642,7 @@ struct test_node_register {

              node_id = rte_node_from_name("test_node00");

              dummy_node_id = rte_node_clone(node_id, "dummy_node");

- if (rte_node_is_invalid(dummy_node_id)) {

+ if (rte_node_is_invalid(dummy_node_id) && (rte_errno != EEXIST)) {

                             printf("Got invalid node id\n");

                             return -1;

              }

@@ -672,7 +674,7 @@ struct test_node_register {

              main_graph_id = rte_graph_from_name("worker0");

              if (main_graph_id == RTE_GRAPH_ID_INVALID) {

                             printf("Must create main graph first\n");

- ret = -1;

+ return -1;

              }



              graph_conf.dispatch.mp_capacity = 1024;

@@ -682,7 +684,7 @@ struct test_node_register {

              if (cloned_graph_id == RTE_GRAPH_ID_INVALID) {

                             printf("Graph creation failed with error = %d\n", rte_errno);

- ret = -1;

+ return -1;

              }



              if (strcmp(rte_graph_id_to_name(cloned_graph_id), "worker0-cloned-test0")) {

@@ -787,7 +789,7 @@ struct test_node_register {

              cloned_graph_id = rte_graph_clone(graph_id, "cloned-test1", &graph_conf);

              node = rte_graph_node_get(cloned_graph_id, nid);

- if (node->dispatch.lcore_id != worker_lcore) {

+ if (!node || node->dispatch.lcore_id != worker_lcore) {

                             printf("set node affinity failed\n");

                             ret = -1;

              }

@@ -859,7 +861,8 @@ struct test_node_register {

              }



              graph = rte_graph_lookup("worker0-cloned-test3");

- if (rte_graph_worker_model_get(graph) != RTE_GRAPH_MODEL_MCORE_DISPATCH) {

+ if (!graph || rte_graph_worker_model_get(graph) !=

+ RTE_GRAPH_MODEL_MCORE_DISPATCH) {

                             printf("Get graph worker model failed\n");

                             ret = -1;

              }

--

1.8.3.1

#2 lore raw

At present rte_graph_destroy will only clean up the struct rte_node and struct graph_node,

not the struct node, rte_node_clone creates the struct node, inserts the global node_list linked list,

there is no function to clean up the node_list linked list, if you want to clean up the node

created by rte_node_clone, Perhaps a new function needs to be added to clean up node_list linked lists.

Or write a test case function to clean up the nodes that are cloned by this test case.

#3 lore raw
Quoted 22 lines

-----Original Message-----
From: Huichao Cai <[email protected]>
Sent: Wednesday, October 23, 2024 8:15 AM
To: Kiran Kumar Kokkilagadda <[email protected]>
Cc: Jerin Jacob <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; [email protected]; [email protected]
Subject: Re:RE: [EXTERNAL] [PATCH] test/graph: fix graph autotest second test failure

At present rte_graph_destroy will only clean up the struct rte_node and struct graph_node, not the struct node, rte_node_clone creates the struct node, inserts the global node_list linked list, there is no function to clean up the node_list

At present rte_graph_destroy will only clean up the struct rte_node and struct graph_node,

not the struct node, rte_node_clone creates the struct node, inserts the global node_list linked list,

Quoted 8 lines

there is no function to clean up the node_list linked list, if you want to clean up the node

created by rte_node_clone, Perhaps a new function needs to be added to clean up node_list linked lists.

Or write a test case function to clean up the nodes that are cloned by this test case.

It makes sense to have an API to clean up the nodes. Are you planning to add this? If not, we can plan and add new API.

#4 lore raw

There is a problem with deleting static nodes: the node ID is recorded using the global variable node_id,

which is continuously increasing. If an intermediate node is deleted, the node ID will appear empty, which

can introduce some problems, such as how to choose the node ID for cloning later?

#5 lore raw
Quoted 16 lines

-----Original Message-----
From: Huichao Cai <[email protected]>
Sent: Thursday, October 24, 2024 12:17 PM
To: Kiran Kumar Kokkilagadda <[email protected]>
Cc: Jerin Jacob <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; [email protected]; [email protected]
Subject: Re:RE: Re:RE: [EXTERNAL] [PATCH] test/graph: fix graph autotest second test failure

There is a problem with deleting static nodes: the node ID is recorded using the global variable node_id, which is continuously increasing. If an intermediate node is deleted, the node ID will appear empty, which can introduce some problems,

Quoted 8 lines

There is a problem with deleting static nodes: the node ID is recorded using the global variable node_id,

which is continuously increasing. If an intermediate node is deleted, the node ID will appear empty, which

can introduce some problems, such as how to choose the node ID for cloning later?

We can fix this node id issue also. Something similar to this has been fixed for graph id Recently. We can do the same thing for node id as well.
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

#7 lore raw
Quoted 32 lines

-----Original Message-----
From: Huichao Cai <[email protected]>
Sent: Friday, October 25, 2024 3:01 PM
To: Kiran Kumar Kokkilagadda <[email protected]>
Cc: Jerin Jacob <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; [email protected]; [email protected]
Subject: Re:RE: Re:RE: Re:RE: [EXTERNAL] [PATCH] test/graph: fix graph autotest second test failure

Quoted 11 lines

We can fix this node id issue also. Something similar to this has been fixed for graph id >Recently. We can do the same thing for node id as well. >https: //patches. dpdk. org/project/dpdk/patch/20240618092324. 54166-2-rjarry@ redhat. com/

We can fix this node id issue also. Something similar to this has been fixed for graph id

Recently. We can do the same thing for node id as well.
https://patches.dpdk.org/project/dpdk/patch/20240618092324.54166-2-

rjar

Quoted 1 line

[email protected]/

<https://urldefense.proofpoint.com/v2/url?u=https-
3A__patches.dpdk.org_project_dpdk_patch_20240618092324.54166-2D2- 2Drjarry- 40redhat.com_&d=DwMGbg&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4F Tmil1Z6oBURwkTThyuRbLAY9LdfiaT6HA&m=N5- YM0oCO9qVUeRP5PqmCAjW9r9TbYSfnXQ8l906YZtptnm-QEfFtR- OBexfJrCS&s=BXf1fzz1sKd-xvzRjpjEjVrnxPKyhu-Plzk0I90s0XI&e=>

Quoted 1 line

So will you be able to complete this change in the near future?

I Will send a patch sometime next week.