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 3036D41D5F; Fri, 24 Feb 2023 16:12:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37A7142B8B; Fri, 24 Feb 2023 16:12:12 +0100 (CET) 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 C84B9427E9 for ; Fri, 24 Feb 2023 16:12:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677251528; 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=X1M/43rTTW/W5AHsm4ogjA9bjbH/hJuhWVzpR+6qmLM=; b=Pod/kR4nuh/N/T9Fuiebc4yaPXpbXifmTJx+Hs9jmS0gCLC21zTXeSX4A55ZuQQjws42h5 EgyATJ59UEDr/J0AeFw6MzFqnPLBxJwo5Gd2t8M74e5qi0+UJewXHTuU5oh8EY81aQAV2D hREfExc8op0l32MNTZiNmxDHTd7N+58= 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-364-tSfacSYUOQCHEw7r4iTmMg-1; Fri, 24 Feb 2023 10:12:06 -0500 X-MC-Unique: tSfacSYUOQCHEw7r4iTmMg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA5CA100F907; Fri, 24 Feb 2023 15:12:05 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5C582026D4B; Fri, 24 Feb 2023 15:12:04 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Subject: [PATCH v2 05/20] graph: annotate graph lock Date: Fri, 24 Feb 2023 16:11:28 +0100 Message-Id: <20230224151143.3274897-6-david.marchand@redhat.com> In-Reply-To: <20230224151143.3274897-1-david.marchand@redhat.com> References: <20230224081642.2566619-1-david.marchand@redhat.com> <20230224151143.3274897-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 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 Export internal lock and annotate associated helper. Signed-off-by: David Marchand --- lib/graph/graph.c | 10 ++++++++-- lib/graph/graph_private.h | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) 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 #include +#include #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 */ /** -- 2.39.2