From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3BF38A054A for ; Tue, 25 Oct 2022 17:10:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3669C42C3D; Tue, 25 Oct 2022 17:10:06 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4E35942C34 for ; Tue, 25 Oct 2022 17:10:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666710603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1bpyiS7Mc9STnJRukeBh7KlBW5i4gEsKJnBCApZoWIM=; b=hdf2UUlq7ubLRggDxFQT9KmDG7eJYqTEYfGPqQBNS60sx8MRx6RT+EIBhjFillwF09clTq dotj+8JV09mAOBHp8XSzwIJIkvCSgTs1cmXm3BikL+8v7lxfKock04serAoapULw4MA87W 7rnQxnBQmr8GoNqK6HbegaqP9V13fr8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-LIqLyrfgOreZZrKsTeelBw-1; Tue, 25 Oct 2022 11:10:00 -0400 X-MC-Unique: LIqLyrfgOreZZrKsTeelBw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB7AD800B23; Tue, 25 Oct 2022 15:09:59 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8F4549BB60; Tue, 25 Oct 2022 15:09:58 +0000 (UTC) From: Kevin Traynor To: Naga Harish K S V Cc: Erik Gabriel Carrillo , dpdk stable Subject: patch 'timer: fix stopping all timers' has been queued to stable release 21.11.3 Date: Tue, 25 Oct 2022 16:07:23 +0100 Message-Id: <20221025150734.142189-88-ktraynor@redhat.com> In-Reply-To: <20221025150734.142189-1-ktraynor@redhat.com> References: <20221025150734.142189-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/01/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/84e55d681a70d5aa9b57e68c80a6b4bbbdf43cba Thanks. Kevin --- >From 84e55d681a70d5aa9b57e68c80a6b4bbbdf43cba Mon Sep 17 00:00:00 2001 From: Naga Harish K S V Date: Wed, 14 Sep 2022 10:33:18 -0500 Subject: [PATCH] timer: fix stopping all timers [ upstream commit eb63c85d7bae32fdc1cbafcd91e88bd6515c39cf ] There is a possibility of deadlock in this API, as same spinlock is tried to be acquired in nested manner. If the lcore that is stopping the timer is different from the lcore that owns the timer, the timer list lock is acquired in timer_del(), even if local_is_locked is true. Because the same lock was already acquired in rte_timer_stop_all(), the thread will hang. This patch removes the acquisition of nested lock. Fixes: 821c51267bcd63a ("timer: add function to stop all timers in a list") Signed-off-by: Naga Harish K S V Acked-by: Erik Gabriel Carrillo --- lib/timer/rte_timer.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/timer/rte_timer.c b/lib/timer/rte_timer.c index 6d19ce469b..98c1941cb1 100644 --- a/lib/timer/rte_timer.c +++ b/lib/timer/rte_timer.c @@ -588,5 +588,5 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, static int -__rte_timer_stop(struct rte_timer *tim, int local_is_locked, +__rte_timer_stop(struct rte_timer *tim, struct rte_timer_data *timer_data) { @@ -610,5 +610,5 @@ __rte_timer_stop(struct rte_timer *tim, int local_is_locked, /* remove it from list */ if (prev_status.state == RTE_TIMER_PENDING) { - timer_del(tim, prev_status, local_is_locked, priv_timer); + timer_del(tim, prev_status, 0, priv_timer); __TIMER_STAT_ADD(priv_timer, pending, -1); } @@ -639,5 +639,5 @@ rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim) TIMER_DATA_VALID_GET_OR_ERR_RET(timer_data_id, timer_data, -EINVAL); - return __rte_timer_stop(tim, 0, timer_data); + return __rte_timer_stop(tim, timer_data); } @@ -995,6 +995,4 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, 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; @@ -1002,12 +1000,9 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, next_tim = tim->sl_next[0]; - /* Call timer_stop with lock held */ - __rte_timer_stop(tim, 1, timer_data); + __rte_timer_stop(tim, timer_data); if (f) f(tim, f_arg); } - - rte_spinlock_unlock(&priv_timer->list_lock); } -- 2.37.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-10-25 14:19:00.533619770 +0100 +++ 0088-timer-fix-stopping-all-timers.patch 2022-10-25 14:18:58.529798514 +0100 @@ -1 +1 @@ -From eb63c85d7bae32fdc1cbafcd91e88bd6515c39cf Mon Sep 17 00:00:00 2001 +From 84e55d681a70d5aa9b57e68c80a6b4bbbdf43cba Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit eb63c85d7bae32fdc1cbafcd91e88bd6515c39cf ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 9994813d0d..85d67573eb 100644 +index 6d19ce469b..98c1941cb1 100644 @@ -29 +30 @@ -@@ -581,5 +581,5 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, +@@ -588,5 +588,5 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks, @@ -36 +37 @@ -@@ -603,5 +603,5 @@ __rte_timer_stop(struct rte_timer *tim, int local_is_locked, +@@ -610,5 +610,5 @@ __rte_timer_stop(struct rte_timer *tim, int local_is_locked, @@ -43 +44 @@ -@@ -632,5 +632,5 @@ rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim) +@@ -639,5 +639,5 @@ rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim) @@ -50 +51 @@ -@@ -988,6 +988,4 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, +@@ -995,6 +995,4 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, @@ -57 +58 @@ -@@ -995,12 +993,9 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores, +@@ -1002,12 +1000,9 @@ rte_timer_stop_all(uint32_t timer_data_id, unsigned int *walk_lcores,