Re: [RFC PATCH v2 2/9] eal: annotate spinlock and rwlock

2022-04-07 Thread David Marchand
On Mon, Apr 4, 2022 at 8:21 AM Stephen Hemminger wrote: > > On Wed, 30 Mar 2022 15:49:49 +0200 > David Marchand wrote: > > > +#ifdef RTE_ANNOTATE_LOCKS > > + > > +#define RTE_ANNOTATED_LOCK \ > > + __attribute__((lockable)) > > + > > +#define RTE_GUARDED_BY(...) \ > > + __attribute__((gua

Re: [RFC PATCH v2 2/9] eal: annotate spinlock and rwlock

2022-04-03 Thread Stephen Hemminger
On Wed, 30 Mar 2022 15:49:49 +0200 David Marchand wrote: > +#ifdef RTE_ANNOTATE_LOCKS > + > +#define RTE_ANNOTATED_LOCK \ > + __attribute__((lockable)) > + > +#define RTE_GUARDED_BY(...) \ > + __attribute__((guarded_by(__VA_ARGS__))) > +#define RTE_GUARDED_VAR \ > + __attribute__((gua

Re: [RFC PATCH v2 2/9] eal: annotate spinlock and rwlock

2022-03-31 Thread David Marchand
On Wed, Mar 30, 2022 at 3:50 PM David Marchand wrote: > diff --git a/lib/eal/include/generic/rte_rwlock.h > b/lib/eal/include/generic/rte_rwlock.h > index da9bc3e9c0..dabbac0131 100644 > --- a/lib/eal/include/generic/rte_rwlock.h > +++ b/lib/eal/include/generic/rte_rwlock.h [snip] > @@ -90,7 +9

[RFC PATCH v2 2/9] eal: annotate spinlock and rwlock

2022-03-30 Thread David Marchand
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. Only rwlock and the "normal