[05/14] graph: annotate graph lock

Message ID 20230224081642.2566619-6-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Enable lock annotations on most libraries and drivers |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

David Marchand Feb. 24, 2023, 8:16 a.m. UTC
  Export internal lock and annotate associated helper.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/graph/graph.c         | 10 ++++++++--
 lib/graph/graph_private.h | 10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)
  

Patch

diff --git a/lib/graph/graph.c b/lib/graph/graph.c
index a839a2803b..5582631b53 100644
--- a/lib/graph/graph.c
+++ b/lib/graph/graph.c
@@ -30,16 +30,22 @@  graph_list_head_get(void)
 	return &graph_list;
 }
 
+rte_spinlock_t *
+graph_spinlock_get(void)
+{
+	return &graph_lock;
+}
+
 void
 graph_spinlock_lock(void)
 {
-	rte_spinlock_lock(&graph_lock);
+	rte_spinlock_lock(graph_spinlock_get());
 }
 
 void
 graph_spinlock_unlock(void)
 {
-	rte_spinlock_unlock(&graph_lock);
+	rte_spinlock_unlock(graph_spinlock_get());
 }
 
 static int
diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h
index 7d1b30b8ac..eacdef45f0 100644
--- a/lib/graph/graph_private.h
+++ b/lib/graph/graph_private.h
@@ -10,6 +10,7 @@ 
 
 #include <rte_common.h>
 #include <rte_eal.h>
+#include <rte_spinlock.h>
 
 #include "rte_graph.h"
 #include "rte_graph_worker.h"
@@ -148,20 +149,25 @@  STAILQ_HEAD(graph_head, graph);
  */
 struct graph_head *graph_list_head_get(void);
 
+rte_spinlock_t *
+graph_spinlock_get(void);
+
 /* Lock functions */
 /**
  * @internal
  *
  * Take a lock on the graph internal spin lock.
  */
-void graph_spinlock_lock(void);
+void graph_spinlock_lock(void)
+	__rte_exclusive_lock_function(graph_spinlock_get());
 
 /**
  * @internal
  *
  * Release a lock on the graph internal spin lock.
  */
-void graph_spinlock_unlock(void);
+void graph_spinlock_unlock(void)
+	__rte_unlock_function(graph_spinlock_get());
 
 /* Graph operations */
 /**