On Tue, Sep 09, 2014 at 11:23:34AM -0700, Alex Wang wrote:
> On current master, the per-thread callback event set is flushed
> when ovsrcu_quiesce_start() is called or when the callback
> event set is full.  For threads that only call 'ovsrcu_quiesce()'
> to indicate quiescient state, their callback event set will not
> be flushed for execution until the set is full.  And this could
> take a very long time.
> 
> Theoretically, this should not be an issue, since rcu postponed
> callback events should only free the old version of objects.
> However, current ovs does not follow this rule, and some callback
> events include other activities like unregistering the netdev
> from global name-netdev map.  The delay of unregistering the netdev
> (by threads that only calls ovsrcu_quiesce()) will prevent the
> recreate of same netdev indefinitely.
> 
> As a short-term workaround, this commit makes every call to
> ovsrcu_quiesce() flush the callback event set.  In the long run,
> there will be a refactor of the use of ovs-rcu module, in which all
> callback events only free the old version of objects.
> 
> Signed-off-by: Alex Wang <al...@nicira.com>
> ---
>  lib/ovs-rcu.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c
> index a052d6c..6fe6103 100644
> --- a/lib/ovs-rcu.c
> +++ b/lib/ovs-rcu.c
> @@ -138,8 +138,14 @@ ovsrcu_quiesce_start(void)
>  void
>  ovsrcu_quiesce(void)
>  {
> +    struct ovsrcu_perthread *perthread;
> +
>      ovsrcu_init_module();
> -    ovsrcu_perthread_get()->seqno = seq_read(global_seqno);
> +    perthread = pthread_getspecific(perthread_key);
> +    perthread->seqno = seq_read(global_seqno);
> +    if (perthread->cbset) {
> +        ovsrcu_flush_cbset(perthread);
> +    }
>      seq_change(global_seqno);

I think that we can remove the call to ovsrcu_init_module() because
ovsrcu_perthread_get() calls it.  (This was also true before your
patch.)

Acked-by: Ben Pfaff <b...@nicira.com>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to