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 EEB7045E03; Mon, 2 Dec 2024 13:53:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB6BD40296; Mon, 2 Dec 2024 13:53:41 +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 222EF40294 for ; Mon, 2 Dec 2024 13:53:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733144020; 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=iPSi9MKoKi19dTmRDWY5tZC/+roR1x8SwFwThfAxh7w=; b=OfSj2i1+LZRcfOGGRUWZt397D/329ZrwsBrmiCCaTg7h5Uhpt8EN8zr1VUnbYd80uRtP0H 1uGfbqVDF6LRi2QjwQLoHHaG5scnyWmmrJcJJXHqL39O7kq8FQGFdUoh3RQEQnb1rMzj2e ROr+hy2Nq/lVWbwZiDzB0kIBMZs4lMY= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-470--Er9-4CUOXegd67tAYDPpg-1; Mon, 02 Dec 2024 07:53:39 -0500 X-MC-Unique: -Er9-4CUOXegd67tAYDPpg-1 X-Mimecast-MFC-AGG-ID: -Er9-4CUOXegd67tAYDPpg Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3AE691955D4F; Mon, 2 Dec 2024 12:53:38 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.129]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A7B891956052; Mon, 2 Dec 2024 12:53:36 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Tyler Retzlaff Subject: [RFC 1/3] eal: add enhanced lock annotations Date: Mon, 2 Dec 2024 13:53:14 +0100 Message-ID: <20241202125316.3732529-2-david.marchand@redhat.com> In-Reply-To: <20241202125316.3732529-1-david.marchand@redhat.com> References: <20241202125316.3732529-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EdOYLkTWejEbxo3QjQ8f-tVx0r-YEj327cvc4Nw8BwQ_1733144018 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 Clang 3.6+ offers enhanced lock annotations when it comes to shared vs exclusive capability/lock release. Introduce macros for those new function attributes. Signed-off-by: David Marchand --- doc/api/doxy-api.conf.in | 12 +++++++ lib/eal/include/rte_lock_annotations.h | 48 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index d23352d300..ac490e7631 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -103,6 +103,18 @@ PREDEFINED = __DOXYGEN__ \ __rte_shared_trylock_function(x)= \ __rte_assert_shared_lock(x)= \ __rte_unlock_function(x)= \ + __rte_capability(x)= \ + __rte_requires_capability(x)= \ + __rte_acquire_capability(x)= \ + __rte_try_acquire_capability(x)= \ + __rte_release_capability(x)= \ + __rte_assert_capability(x)= \ + __rte_requires_shared_capability(x)= \ + __rte_acquire_shared_capability(x)= \ + __rte_try_acquire_shared_capability(x)= \ + __rte_release_shared_capability(x)= \ + __rte_assert_shared_capability(x)= \ + __rte_exclude_capability(x)= \ __attribute__(x)= OPTIMIZE_OUTPUT_FOR_C = YES diff --git a/lib/eal/include/rte_lock_annotations.h b/lib/eal/include/rte_lock_annotations.h index 2456a69352..4240458c53 100644 --- a/lib/eal/include/rte_lock_annotations.h +++ b/lib/eal/include/rte_lock_annotations.h @@ -43,6 +43,36 @@ extern "C" { #define __rte_locks_excluded(...) \ __attribute__((locks_excluded(__VA_ARGS__))) + +#define __rte_capability(...) \ + __attribute__((capability(__VA_ARGS__))) + +#define __rte_requires_capability(...) \ + __attribute__((requires_capability(__VA_ARGS__))) +#define __rte_acquire_capability(...) \ + __attribute__((acquire_capability(__VA_ARGS__))) +#define __rte_try_acquire_capability(ret, ...) \ + __attribute__((try_acquire_capability(ret, __VA_ARGS__))) +#define __rte_release_capability(...) \ + __attribute__((release_capability(__VA_ARGS__))) +#define __rte_assert_capability(...) \ + __attribute__((assert_capability(__VA_ARGS__))) + +#define __rte_requires_shared_capability(...) \ + __attribute__((requires_shared_capability(__VA_ARGS__))) +#define __rte_acquire_shared_capability(...) \ + __attribute__((acquire_shared_capability(__VA_ARGS__))) +#define __rte_try_acquire_shared_capability(ret, ...) \ + __attribute__((try_acquire_shared_capability(ret, __VA_ARGS__))) +#define __rte_release_shared_capability(...) \ + __attribute__((release_shared_capability(__VA_ARGS__))) +#define __rte_assert_shared_capability(...) \ + __attribute__((assert_shared_capability(__VA_ARGS__))) + +#define __rte_exclude_capability(...) \ + __attribute__((exclude_capability(__VA_ARGS__))) + + #define __rte_no_thread_safety_analysis \ __attribute__((no_thread_safety_analysis)) @@ -67,6 +97,24 @@ extern "C" { #define __rte_locks_excluded(...) + +#define __rte_capability(...) + +#define __rte_requires_capability(...) +#define __rte_acquire_capability(...) +#define __rte_try_acquire_capability(...) +#define __rte_release_capability(...) +#define __rte_assert_capability(...) + +#define __rte_requires_shared_capability(...) +#define __rte_acquire_shared_capability(...) +#define __rte_try_acquire_shared_capability(...) +#define __rte_release_shared_capability(...) +#define __rte_assert_shared_capability(...) + +#define __rte_exclude_capability(...) + + #define __rte_no_thread_safety_analysis #endif /* RTE_ANNOTATE_LOCKS */ -- 2.47.0