[ovs-dev] [PATCH v2 6/8] ovs-thread: Quiesce when joining pthreads
i.maximets at ovn.org
Wed Jun 30 09:09:12 UTC 2021
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.
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.
More information about the dev