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 CFE3741D5F; Fri, 24 Feb 2023 16:13:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32BC742D3A; Fri, 24 Feb 2023 16:12:39 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id B258742D3D for ; Fri, 24 Feb 2023 16:12:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677251557; 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=QHSias8zg/nWLRhrBkSMJQy7pTrcEFjgQUDrQoJnJHs=; b=B+hDL2gN/t5o/u+dNwzTx591pYvwYJOZKCqJ/68qfDeLyDhrRq7djqteWBEGkW0AcY/jqd YQ6eO9dMQww5z7pcfWstNoxT38iFR7BJWjRWshtlLdTZB8XRXIJYM1SPskx4q7SrB1VcGB TUNZiXz0cqAouTO2pucqF0+vT0/tLDY= 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-587-gauduz42MqS9cPFDxpzdlQ-1; Fri, 24 Feb 2023 10:12:35 -0500 X-MC-Unique: gauduz42MqS9cPFDxpzdlQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E99195D601; Fri, 24 Feb 2023 15:12:34 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8560C1121314; Fri, 24 Feb 2023 15:12:33 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Ori Kam , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH v2 15/20] ethdev: annotate pthread mutex Date: Fri, 24 Feb 2023 16:11:38 +0100 Message-Id: <20230224151143.3274897-16-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.3 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 fts_enter/exit take mutexes depending on device flags set at initialisation. Annotate those helpers and, since clang does not support conditional locking, waive the lock check on their implementation. Signed-off-by: David Marchand --- lib/ethdev/rte_flow.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 69e6e749f7..c66625d1fe 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -297,6 +297,10 @@ rte_flow_dynf_metadata_register(void) static inline void fts_enter(struct rte_eth_dev *dev) +#ifdef RTE_EXEC_ENV_FREEBSD + __rte_exclusive_lock_function(dev->data->flow_ops_mutex) + __rte_no_thread_safety_analysis +#endif { if (!(dev->data->dev_flags & RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE)) pthread_mutex_lock(&dev->data->flow_ops_mutex); @@ -304,6 +308,10 @@ fts_enter(struct rte_eth_dev *dev) static inline void fts_exit(struct rte_eth_dev *dev) +#ifdef RTE_EXEC_ENV_FREEBSD + __rte_unlock_function(dev->data->flow_ops_mutex) + __rte_no_thread_safety_analysis +#endif { if (!(dev->data->dev_flags & RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE)) pthread_mutex_unlock(&dev->data->flow_ops_mutex); -- 2.39.2