On Jan 22, 2014, at 4:11 PM, Ben Pfaff <[email protected]> wrote:
> Signed-off-by: Ben Pfaff <[email protected]>
> ---
> configure.ac | 1 +
> lib/automake.mk | 3 ++
> lib/ovs-rcu-liburcu.h | 65 +++++++++++++++++++++++++++++++++++++++++
> lib/ovs-rcu-norcu.h | 58 ++++++++++++++++++++++++++++++++++++
> lib/ovs-rcu.h | 36 +++++++++++++++++++++++
> lib/ovs-thread.c | 23 +++++++++++++--
> lib/timeval.c | 13 +++++++++
> m4/openvswitch.m4 | 16 ++++++++++
> ofproto/ofproto-dpif-upcall.c | 5 ++++
> 9 files changed, 218 insertions(+), 2 deletions(-)
> create mode 100644 lib/ovs-rcu-liburcu.h
> create mode 100644 lib/ovs-rcu-norcu.h
> create mode 100644 lib/ovs-rcu.h
>
...
> diff --git a/configure.ac b/configure.ac
> index 9b6c69e..a9c5cfe 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -70,6 +70,7 @@ AC_CHECK_FUNCS([mlockall strnlen getloadavg statvfs
> getmntent_r])
> AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h
> stdatomic.h])
> AC_CHECK_HEADERS([net/if_mib.h], [], [], [[#include <sys/types.h>
> #include <net/if.h>]])
> +OVS_CHECK_LIBURCU
>
> OVS_CHECK_PKIDIR
> OVS_CHECK_RUNDIR
> diff --git a/lib/automake.mk b/lib/automake.mk
> index 94ba060..b2950ad 100644
> --- a/lib/automake.mk
> +++ b/lib/automake.mk
> @@ -141,6 +141,9 @@ lib_libopenvswitch_la_SOURCES = \
> lib/ovs-atomic-pthreads.c \
> lib/ovs-atomic-pthreads.h \
> lib/ovs-atomic.h \
> + lib/ovs-rcu-liburcu.h \
> + lib/ovs-rcu-norcu.h \
> + lib/ovs-rcu.h \
> lib/ovs-thread.c \
> lib/ovs-thread.h \
> lib/ovsdb-data.c \
> diff --git a/lib/ovs-rcu-liburcu.h b/lib/ovs-rcu-liburcu.h
> new file mode 100644
> index 0000000..b1ea4ea
> --- /dev/null
> +++ b/lib/ovs-rcu-liburcu.h
> @@ -0,0 +1,65 @@
> +/*
> + * Copyright (c) 2014 Nicira, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +/* This header implements RCU primitives using liburcu. */
> +#ifndef IN_OVS_RCU_H
> +#error "This header should only be included indirectly via ovs-rcu.h."
> +#endif
> +
> +#include <urcu-qsbr.h>
This file doesn’t exist. Should I install something to get this?
...
> diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
> index 8364376..ce1f452 100644
> --- a/lib/ovs-thread.c
> +++ b/lib/ovs-thread.c
> @@ -20,6 +20,7 @@
> #include <poll.h>
> #include <stdlib.h>
> #include <unistd.h>
> +#include <urcu-qsbr.h>
> #include "compiler.h"
> #include "hash.h"
> #include "poll-loop.h"
> @@ -185,7 +186,12 @@ void
> ovs_mutex_cond_wait(pthread_cond_t *cond, const struct ovs_mutex *mutex_)
> {
> struct ovs_mutex *mutex = CONST_CAST(struct ovs_mutex *, mutex_);
> - int error = pthread_cond_wait(cond, &mutex->lock);
> + int error;
> +
> + rcu_thread_offline();
> + error = pthread_cond_wait(cond, &mutex->lock);
> + rcu_thread_online();
> +
> if (OVS_UNLIKELY(error)) {
> ovs_abort(error, "pthread_cond_wait failed");
> }
> @@ -198,6 +204,12 @@ struct ovsthread_aux {
> void *arg;
> };
>
> +static void
> +unregister_rcu(void *unused OVS_UNUSED)
> +{
> + rcu_unregister_thread();
> +}
> +
> static void *
> ovsthread_wrapper(void *aux_)
> {
> @@ -206,14 +218,21 @@ ovsthread_wrapper(void *aux_)
> struct ovsthread_aux *auxp = aux_;
> struct ovsthread_aux aux;
> unsigned int id;
> + void *retval;
>
> atomic_add(&next_id, 1, &id);
> *ovsthread_id_get() = id;
>
> + rcu_register_thread();
> +
This function seems to be missing. This from the file I’m missing?
Jarno
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev