[ovs-dev] [PATCHv17 1/2] ovs-thread: Add pthread spin lock support.

Ben Pfaff blp at ovn.org
Thu Jul 18 18:08:09 UTC 2019


On Thu, Jul 18, 2019 at 07:38:03PM +0300, Ilya Maximets wrote:
> On 17.07.2019 23:23, William Tu wrote:
> > The patch adds the basic spin lock functions:
> > ovs_spin_{lock, try_lock, unlock, init, destroy}.
> > OSX does not support pthread spin lock, so make it
> > linux only.
> 
> The last sentence seems redundant now and could be removed.
> 
> The patch looks good to me. One thing I'd like to add is the additional
> AC_SEARCH_LIBS([pthread_spin_lock], [pthread])
> This way we'll be sure that '-lpthread' will be passed to the function
> check if needed.
> 
> So, I'm suggesting:
> 
> diff --git a/configure.ac b/configure.ac
> index c33935499..398a390a5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -79,6 +79,8 @@ AC_SEARCH_LIBS([clock_gettime], [rt])
>  AC_SEARCH_LIBS([timer_create], [rt])
>  AC_SEARCH_LIBS([pthread_rwlock_tryrdlock], [pthread])
>  AC_SEARCH_LIBS([pthread_rwlockattr_destroy], [pthread])
> +AC_SEARCH_LIBS([pthread_spin_lock], [pthread])
> +AC_CHECK_FUNCS([pthread_spin_lock])
>  AC_FUNC_STRERROR_R
>  
>  OVS_CHECK_WIN64
> @@ -109,7 +111,6 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], [], [],
>  #include <sys/types.h>
>  #include <netinet/in.h>]])
>  AC_CHECK_FUNCS([mlockall strnlen getloadavg statvfs getmntent_r sendmmsg clock_gettime])
> -AC_CHECK_FUNCS([pthread_spin_lock])
>  AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h])
>  AC_CHECK_HEADERS([linux/net_namespace.h stdatomic.h bits/floatn-common.h])
>  AC_CHECK_HEADERS([net/if_mib.h], [], [], [[#include <sys/types.h>
> ---
> 
> If above diff is OK, I could apply it myself right before merging the patch.
> William, Ben, what do you think?

Seems OK to me.


More information about the dev mailing list