DPDK patches and discussions
 help / color / mirror / Atom feed
From: Naga Harish K S V <s.v.naga.harish.k@intel.com>
To: erik.g.carrillo@intel.com
Cc: dev@dpdk.org
Subject: [PATCH 3/4] timer: fix rte_timer_stop_all
Date: Wed,  3 Aug 2022 11:26:51 -0500	[thread overview]
Message-ID: <20220803162651.3145945-1-s.v.naga.harish.k@intel.com> (raw)

there is a possibility of deadlock in this api,
as same spinlock is tried to be acquired in nested manner.

This patch removes the acquisition of nested locking.

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 lib/timer/rte_timer.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/timer/rte_timer.c b/lib/timer/rte_timer.c
index 9994813d0d..cfbc8cb028 100644
--- a/lib/timer/rte_timer.c
+++ b/lib/timer/rte_timer.c
@@ -987,21 +987,16 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores,
 		walk_lcore = walk_lcores[i];
 		priv_timer = &timer_data->priv_timer[walk_lcore];
 
-		rte_spinlock_lock(&priv_timer->list_lock);
-
 		for (tim = priv_timer->pending_head.sl_next[0];
 		     tim != NULL;
 		     tim = next_tim) {
 			next_tim = tim->sl_next[0];
 
-			/* Call timer_stop with lock held */
-			__rte_timer_stop(tim, 1, timer_data);
+			__rte_timer_stop(tim, 0, timer_data);
 
 			if (f)
 				f(tim, f_arg);
 		}
-
-		rte_spinlock_unlock(&priv_timer->list_lock);
 	}
 
 	return 0;
-- 
2.25.1


             reply	other threads:[~2022-08-03 16:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 16:26 Naga Harish K S V [this message]
2022-08-03 17:49 ` Stephen Hemminger
2022-08-10  7:20   ` Naga Harish K, S V
2022-08-10  7:09 ` [PATCH v2 3/4] timer: fix function to stop all timers Naga Harish K S V
2022-08-10 19:29   ` Carrillo, Erik G
2022-08-10 19:38     ` Stephen Hemminger
2022-08-11 15:42     ` Naga Harish K, S V
2022-08-11 15:37   ` [PATCH v3 " Naga Harish K S V
2022-08-12 16:07     ` [PATCH v4 " Naga Harish K S V
2022-08-18 13:12       ` Carrillo, Erik G

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=20220803162651.3145945-1-s.v.naga.harish.k@intel.com \
    --to=s.v.naga.harish.k@intel.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@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).