From: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
To: <dev@dpdk.org>
Cc: "Bruce Richardson" <bruce.richardson@intel.com>,
"Thomas Monjalon" <thomas@monjalon.net>,
"David Marchand" <david.marchand@redhat.com>,
Honnappa.Nagarahalli@arm.com, mb@smartsharesystems.com,
hofors@lysator.liu.se,
"Stephen Hemminger" <stephen@networkplumber.org>,
"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
michalx.k.jastrzebski@intel.com, stable@dpdk.org,
"Min Hu" <humin29@huawei.com>
Subject: [PATCH 3/3] examples/bond: fix invalid use of trylock
Date: Mon, 11 Apr 2022 17:15:59 +0200 [thread overview]
Message-ID: <20220411151559.164217-3-mattias.ronnblom@ericsson.com> (raw)
In-Reply-To: <20220411151559.164217-1-mattias.ronnblom@ericsson.com>
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")
Cc: michalx.k.jastrzebski@intel.com
Cc: stable@dpdk.org
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.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 335bde5c8d..4efebb3902 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -373,7 +373,7 @@ static int lcore_main(__rte_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);
@@ -456,7 +456,7 @@ static int lcore_main(__rte_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");
@@ -571,7 +571,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result,
{
int worker_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) {
@@ -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))
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,
@@ -659,7 +659,7 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result,
struct cmdline *cl,
__rte_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",
@@ -700,7 +700,7 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result,
struct cmdline *cl,
__rte_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",
@@ -762,7 +762,7 @@ static void cmd_show_parsed(__rte_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.25.1
next parent reply other threads:[~2022-04-11 15:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <YlPx85fQa0XbUf/O@bricha3-MOBL.ger.corp.intel.com>
[not found] ` <20220411151559.164217-1-mattias.ronnblom@ericsson.com>
2022-04-11 15:15 ` Mattias Rönnblom [this message]
2022-04-14 12:06 ` David Marchand
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=20220411151559.164217-3-mattias.ronnblom@ericsson.com \
--to=mattias.ronnblom@ericsson.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=hofors@lysator.liu.se \
--cc=humin29@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=michalx.k.jastrzebski@intel.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).