patch 'examples/bond: fix invalid use of trylock' has been queued to stable release 19.11.13

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Thu Jul 7 09:53:57 CEST 2022


Hi,

FYI, your patch has been queued to stable release 19.11.13

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/09/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/2b9663aec4d2eecf2eacc58f2936582ac4c2c5b4

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 2b9663aec4d2eecf2eacc58f2936582ac4c2c5b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= <mattias.ronnblom at ericsson.com>
Date: Mon, 11 Apr 2022 17:15:59 +0200
Subject: [PATCH] examples/bond: fix invalid use of trylock
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit 03382cf4115019e6a82d6fca51a16a34a0824a90 ]

The conditional rte_spinlock_trylock() was used as if it is an
unconditional lock operation in a number of places.

Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")

Signed-off-by: Mattias Rönnblom <mattias.ronnblom at ericsson.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Min Hu (Connor) <humin29 at huawei.com>
Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 examples/bond/main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index d4de4b9e68..9243a85501 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -379,7 +379,7 @@ static int lcore_main(__attribute__((unused)) void *arg1)
 	bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) |
 				(BOND_IP_3 << 16) | (BOND_IP_4 << 24);
 
-	rte_spinlock_trylock(&global_flag_stru_p->lock);
+	rte_spinlock_lock(&global_flag_stru_p->lock);
 
 	while (global_flag_stru_p->LcoreMainIsRunning) {
 		rte_spinlock_unlock(&global_flag_stru_p->lock);
@@ -460,7 +460,7 @@ static int lcore_main(__attribute__((unused)) void *arg1)
 			if (is_free == 0)
 				rte_pktmbuf_free(pkts[i]);
 		}
-		rte_spinlock_trylock(&global_flag_stru_p->lock);
+		rte_spinlock_lock(&global_flag_stru_p->lock);
 	}
 	rte_spinlock_unlock(&global_flag_stru_p->lock);
 	printf("BYE lcore_main\n");
@@ -575,7 +575,7 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,
 {
 	int slave_core_id = rte_lcore_id();
 
-	rte_spinlock_trylock(&global_flag_stru_p->lock);
+	rte_spinlock_lock(&global_flag_stru_p->lock);
 	if (global_flag_stru_p->LcoreMainIsRunning == 0) {
 		if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore)
 		    != WAIT) {
@@ -595,7 +595,7 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,
 	if ((slave_core_id >= RTE_MAX_LCORE) || (slave_core_id == 0))
 		return;
 
-	rte_spinlock_trylock(&global_flag_stru_p->lock);
+	rte_spinlock_lock(&global_flag_stru_p->lock);
 	global_flag_stru_p->LcoreMainIsRunning = 1;
 	rte_spinlock_unlock(&global_flag_stru_p->lock);
 	cmdline_printf(cl,
@@ -663,7 +663,7 @@ static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
 			    struct cmdline *cl,
 			    __attribute__((unused)) void *data)
 {
-	rte_spinlock_trylock(&global_flag_stru_p->lock);
+	rte_spinlock_lock(&global_flag_stru_p->lock);
 	if (global_flag_stru_p->LcoreMainIsRunning == 0)	{
 		cmdline_printf(cl,
 					"lcore_main not running on core:%d\n",
@@ -704,7 +704,7 @@ static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
 			    struct cmdline *cl,
 			    __attribute__((unused)) void *data)
 {
-	rte_spinlock_trylock(&global_flag_stru_p->lock);
+	rte_spinlock_lock(&global_flag_stru_p->lock);
 	if (global_flag_stru_p->LcoreMainIsRunning == 0)	{
 		cmdline_printf(cl,
 					"lcore_main not running on core:%d\n",
@@ -766,7 +766,7 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result,
 		printf("\n");
 	}
 
-	rte_spinlock_trylock(&global_flag_stru_p->lock);
+	rte_spinlock_lock(&global_flag_stru_p->lock);
 	cmdline_printf(cl,
 			"Active_slaves:%d "
 			"packets received:Tot:%d Arp:%d IPv4:%d\n",
-- 
2.37.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-07-07 09:54:11.231336066 +0200
+++ 0002-examples-bond-fix-invalid-use-of-trylock.patch	2022-07-07 09:54:10.769823406 +0200
@@ -1 +1 @@
-From 03382cf4115019e6a82d6fca51a16a34a0824a90 Mon Sep 17 00:00:00 2001
+From 2b9663aec4d2eecf2eacc58f2936582ac4c2c5b4 Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit 03382cf4115019e6a82d6fca51a16a34a0824a90 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 335bde5c8d..4efebb3902 100644
+index d4de4b9e68..9243a85501 100644
@@ -27 +28 @@
-@@ -373,7 +373,7 @@ static int lcore_main(__rte_unused void *arg1)
+@@ -379,7 +379,7 @@ static int lcore_main(__attribute__((unused)) void *arg1)
@@ -36 +37 @@
-@@ -456,7 +456,7 @@ static int lcore_main(__rte_unused void *arg1)
+@@ -460,7 +460,7 @@ static int lcore_main(__attribute__((unused)) void *arg1)
@@ -45 +46 @@
-@@ -571,7 +571,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result,
+@@ -575,7 +575,7 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,
@@ -47 +48 @@
- 	int worker_core_id = rte_lcore_id();
+ 	int slave_core_id = rte_lcore_id();
@@ -54,2 +55,2 @@
-@@ -591,7 +591,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result,
- 	if ((worker_core_id >= RTE_MAX_LCORE) || (worker_core_id == 0))
+@@ -595,7 +595,7 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,
+ 	if ((slave_core_id >= RTE_MAX_LCORE) || (slave_core_id == 0))
@@ -63 +64 @@
-@@ -659,7 +659,7 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result,
+@@ -663,7 +663,7 @@ static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
@@ -65 +66 @@
- 			    __rte_unused void *data)
+ 			    __attribute__((unused)) void *data)
@@ -72 +73 @@
-@@ -700,7 +700,7 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result,
+@@ -704,7 +704,7 @@ static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
@@ -74 +75 @@
- 			    __rte_unused void *data)
+ 			    __attribute__((unused)) void *data)
@@ -81 +82 @@
-@@ -762,7 +762,7 @@ static void cmd_show_parsed(__rte_unused void *parsed_result,
+@@ -766,7 +766,7 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result,


More information about the stable mailing list