> The problem with CPUs coming up late is indeed present in this patch, > I'll review your patch on the flight. :) > > synchronize_rcu() is actually relatively cheap with URCU, so I guess > that's fine. An alternative to that could be a pthread_barrier_t, but > it can be added later. > > Another way to fix the issue with a variable number of waiters could be > to wrap safe work with rcu_read_lock and rcu_read_unlock, and put a > synchronize_rcu() at the beginning of the CPU thread function. But it > can be done later too. > > Your patch from a year ago, right now, seems to be the best to me. I'd > like to make it use regular work items instead of the special > cpu->tcg_work_func, but that's pretty much it.
Ok, I think I have something. It only uses condition variables when there is a safe work in flight, to enter and leave the function at the right time. It also makes linux-user's start_exclusive/end_exclusive use the same synchronization logic. I'll test it and post; most preliminary patches are straight from this series. Paolo