Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-30 Thread Alex Wang
Sorry should send notice, I figured it out later yesterday. Thanks Ben, On Tue, Jul 30, 2013 at 10:48 AM, Ben Pfaff wrote: > On Mon, Jul 29, 2013 at 05:19:04PM -0700, Alex Wang wrote: > > On Mon, Jul 29, 2013 at 10:47 AM, Ben Pfaff wrote: > > > > > @@ -22,59 +22,55 @@ > > > #include > > >

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-30 Thread Ben Pfaff
On Mon, Jul 29, 2013 at 05:19:04PM -0700, Alex Wang wrote: > On Mon, Jul 29, 2013 at 10:47 AM, Ben Pfaff wrote: > > > @@ -22,59 +22,55 @@ > > #include > > #include "ovs-atomic.h" > > #include "util.h" > > + > > +/* Mutex. */ > > > > struct OVS_LOCKABLE ovs_mutex { > > pthread_mutex_t lo

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Alex Wang
On Mon, Jul 29, 2013 at 10:47 AM, Ben Pfaff wrote: > @@ -22,59 +22,55 @@ > #include > #include "ovs-atomic.h" > #include "util.h" > + > +/* Mutex. */ > > struct OVS_LOCKABLE ovs_mutex { > pthread_mutex_t lock; > const char *where; > }; > > -struct OVS_LOCKABLE ovs_rwlock { > -

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ethan Jackson
> Yeah, I understand the rationale, I just want to know whether we can > make the pointer const. I'm fine with it. I used the same trick in some other patches, I'll be sure to update them. Ethan X-CudaMail-Whitelist-To: dev@openvswitch.org ___ dev mail

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ben Pfaff
On Mon, Jul 29, 2013 at 02:10:40PM -0700, Ethan Jackson wrote: > > In lockfile.c, I guess that clang can only handle guarded-by on > > pointers? Otherwise I don't see why one would introduce the new > > lock_table variable as a level of indirection. Assuming that's true, > > can we declare lock_t

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ethan Jackson
> OVS_RELEASES applies to both read-locks and write-locks? > > I guess that an ordinary mutex is considered a write-lock? Yep, I suppose we could create a second #define for that. Not sure if it matters or not. > In lockfile.c, I guess that clang can only handle guarded-by on > pointers? Otherw

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ben Pfaff
On Fri, Jul 26, 2013 at 06:07:02PM -0700, Ethan Jackson wrote: > This commit adds annotations for thread safety check. And the > check can be conducted by using -Wthread-safety flag in clang. > > Co-authored-by: Alex Wang > Signed-off-by: Alex Wang > Signed-off-by: Ethan Jackson Currently, the

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ben Pfaff
On Mon, Jul 29, 2013 at 11:06:55AM -0700, Alex Wang wrote: > > > +#if __has_feature(c_thread_safety_attributes) > > > +/* "clang" annotations for thread safety check. > > > + * > > > + * OVS_LOCKABLE indicates that the struct contains mutex element > > > + * which can be locked by ovs_mutex_lock().

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ben Pfaff
On Mon, Jul 29, 2013 at 10:47:47AM -0700, Ben Pfaff wrote: > On Fri, Jul 26, 2013 at 06:07:02PM -0700, Ethan Jackson wrote: > > This commit adds annotations for thread safety check. And the > > check can be conducted by using -Wthread-safety flag in clang. One additional thought. In reading the a

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Alex Wang
> > +#if __has_feature(c_thread_safety_attributes) > > +/* "clang" annotations for thread safety check. > > + * > > + * OVS_LOCKABLE indicates that the struct contains mutex element > > + * which can be locked by ovs_mutex_lock(). > > + * > > What does the following sentence mean? I do not underst

Re: [ovs-dev] [thread-safety 01/11] clang: Add annotations for thread safety check.

2013-07-29 Thread Ben Pfaff
On Fri, Jul 26, 2013 at 06:07:02PM -0700, Ethan Jackson wrote: > This commit adds annotations for thread safety check. And the > check can be conducted by using -Wthread-safety flag in clang. I would think that the commit should also explain where to get clang with this support, probably by adding