On 5/20/21 3:35 PM, Gaetan Rivet wrote:
> Joining pthreads makes the caller quiescent. It should register as such,
> as joined threads may wait on an RCU callback executing before quitting,
> deadlocking the caller.

Hi, Gaetan.

This patch doesn't look right to me.  The problem is that users of this
function has no idea that the quiescent state will be entered by this
function.  And this is really hard to track down, because it can be called
very deep inside some separate part of the code base that user at the
top level might not even know about.  For example, a lot of call chains
in ovsdb-server may lead to xpthread_join called from ovsdb/log.c.
Even though ovsdb-server is single-threaded now, insertion of the
ovsrcu_quiesce_start() into xpthread_join() will effectively mean that
ovsdb-server will never be able to use RCU if it will become multi-threaded
someday, e.g. it will not be able to use CMAPs.

So, instead of doing that, callers should enter quiescent state before
joining, and this should be done at the highest level of a call chain
possible.  We have the same thing with cond_wait() implementation, you
may add similar comment to the join() function as we have for cond_wait().

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to