patch 'eal/freebsd: fix lock in alarm callback' has been queued to stable release 20.11.8

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Feb 23 10:37:09 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/25/23. 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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/45ff268fbc9d20911bde534876f99c826b2ac562

Thanks.

Luca Boccassi

---
>From 45ff268fbc9d20911bde534876f99c826b2ac562 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen at huawei.com>
Date: Mon, 13 Feb 2023 12:44:52 +0000
Subject: [PATCH] eal/freebsd: fix lock in alarm callback

[ upstream commit fc6bdd5248e843ba1300c8d46d43b263b4a69438 ]

The spinlock should unlock when clock_gettime() failed. This patch
fixes it by invoking clock_gettime() before lock.

Fixes: 26021a715067 ("eal/bsd: support alarm API")

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/librte_eal/freebsd/eal_alarm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/freebsd/eal_alarm.c b/lib/librte_eal/freebsd/eal_alarm.c
index c38b2e04f8..3677bdfe40 100644
--- a/lib/librte_eal/freebsd/eal_alarm.c
+++ b/lib/librte_eal/freebsd/eal_alarm.c
@@ -148,12 +148,12 @@ eal_alarm_callback(void *arg __rte_unused)
 	struct timespec now;
 	struct alarm_entry *ap;
 
-	rte_spinlock_lock(&alarm_list_lk);
-	ap = LIST_FIRST(&alarm_list);
-
 	if (clock_gettime(CLOCK_TYPE_ID, &now) < 0)
 		return;
 
+	rte_spinlock_lock(&alarm_list_lk);
+	ap = LIST_FIRST(&alarm_list);
+
 	while (ap != NULL && timespec_cmp(&now, &ap->time) >= 0) {
 		ap->executing = 1;
 		ap->executing_id = pthread_self();
-- 
2.39.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-02-23 09:36:30.887116157 +0000
+++ 0065-eal-freebsd-fix-lock-in-alarm-callback.patch	2023-02-23 09:36:28.350172224 +0000
@@ -1 +1 @@
-From fc6bdd5248e843ba1300c8d46d43b263b4a69438 Mon Sep 17 00:00:00 2001
+From 45ff268fbc9d20911bde534876f99c826b2ac562 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit fc6bdd5248e843ba1300c8d46d43b263b4a69438 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -15 +16 @@
- lib/eal/freebsd/eal_alarm.c | 6 +++---
+ lib/librte_eal/freebsd/eal_alarm.c | 6 +++---
@@ -18,5 +19,5 @@
-diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c
-index 1023c32937..1a3e6c0aad 100644
---- a/lib/eal/freebsd/eal_alarm.c
-+++ b/lib/eal/freebsd/eal_alarm.c
-@@ -171,12 +171,12 @@ eal_alarm_callback(void *arg __rte_unused)
+diff --git a/lib/librte_eal/freebsd/eal_alarm.c b/lib/librte_eal/freebsd/eal_alarm.c
+index c38b2e04f8..3677bdfe40 100644
+--- a/lib/librte_eal/freebsd/eal_alarm.c
++++ b/lib/librte_eal/freebsd/eal_alarm.c
+@@ -148,12 +148,12 @@ eal_alarm_callback(void *arg __rte_unused)


More information about the stable mailing list