[PATCH v6 1/9] eal: annotate spinlock, rwlock and seqlock
Xia, Chenbo
chenbo.xia at intel.com
Thu Feb 9 09:00:18 CET 2023
> -----Original Message-----
> From: David Marchand <david.marchand at redhat.com>
> Sent: Tuesday, February 7, 2023 6:45 PM
> To: dev at dpdk.org
> Cc: maxime.coquelin at redhat.com; stephen at networkplumber.org; Xia, Chenbo
> <chenbo.xia at intel.com>; Hu, Jiayu <jiayu.hu at intel.com>; Wang, YuanX
> <yuanx.wang at intel.com>; Ding, Xuan <xuan.ding at intel.com>;
> mb at smartsharesystems.com; Burakov, Anatoly <anatoly.burakov at intel.com>;
> mattias.ronnblom <mattias.ronnblom at ericsson.com>; David Christensen
> <drc at linux.vnet.ibm.com>; Richardson, Bruce <bruce.richardson at intel.com>;
> Konstantin Ananyev <konstantin.v.ananyev at yandex.ru>
> Subject: [PATCH v6 1/9] eal: annotate spinlock, rwlock and seqlock
>
> clang offers some thread safety checks, statically verifying that locks
> are taken and released in the code.
> To use those checks, the full code leading to taking or releasing locks
> must be annotated with some attributes.
>
> Wrap those attributes into our own set of macros.
>
> rwlock, seqlock and the "normal" spinlock are instrumented.
>
> Those checks might be of interest out of DPDK, but it requires that the
> including application locks are annotated.
> On the other hand, applications out there might have been using
> those same checks.
> To be on the safe side, keep this instrumentation under a
> RTE_ANNOTATE_LOCKS internal build flag.
>
> A component may en/disable this check by setting
> annotate_locks = true/false in its meson.build.
>
> Note:
> Doxygen preprocessor does not understand trailing function attributes
> (this can be observed with the rte_seqlock.h header).
> One would think that expanding the annotation macros to a noop in
> rte_lock_annotations.h would be enough (since RTE_ANNOTATE_LOCKS is not
> set during doxygen processing)). Unfortunately, the use of
> EXPAND_ONLY_PREDEF defeats this.
>
> Removing EXPAND_ONLY_PREDEF entirely is not an option as it would expand
> all other DPDK macros.
>
> The chosen solution is to expand the annotation macros explicitly to a
> noop in PREDEFINED.
>
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> Acked-by: Morten Brørup <mb at smartsharesystems.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
> ---
> --
> 2.39.1
Acked-by: Chenbo Xia <chenbo.xia at intel.com>
More information about the dev
mailing list