From patchwork Wed Aug 3 16:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Naga Harish K, S V" X-Patchwork-Id: 114591 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A173A00C5; Wed, 3 Aug 2022 18:27:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26A4E42BAB; Wed, 3 Aug 2022 18:27:14 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 41D6D40A7E for ; Wed, 3 Aug 2022 18:27:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659544033; x=1691080033; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xvTtyyPK/XBsMwTewbRd6gRN6CxbjYBTKDWEUgyfG/g=; b=JwJ0mnDlEnCMgdRJwHSXFedOjc56BVg7LNlRdeVFiIVbji/8IJ+zSaXH FDL+9nylGbKhZVebcTkexLam2yrZ0v9cZgpbc4QA/E1mANXR9I/fr6Eka YBZqenZEL98bNPcSs6+QhQiuRO3aHmdOZecOGRW5VTt3nWXJ1kKOIQBqF RekCX45Iv/CDTJqaLmyUUSVwjJa+IJlaCcsF79Tsow1Uoctq4VdB+8TBh nQvXpzwVjrY118gM4Ltva/9vihn3GvK/veLxcIN69s4Wf18jnHolIF33L tP05ky3BF5CwpyBIZN+NHBEcV32p706owjW6N6hXmWkoy4kPHQlBsGAR7 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10428"; a="290491342" X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="290491342" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2022 09:26:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="578711150" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga006.jf.intel.com with ESMTP; 03 Aug 2022 09:26:55 -0700 From: Naga Harish K S V 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 Message-Id: <20220803162651.3145945-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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;