On Sun, Aug 23, 2015 at 19:01:28 -0700, Paolo Bonzini wrote:
> > * tb_flush: do it once all other CPUs have been put to sleep by calling
> > rcu_synchronize().
> > We also instrument tb_lock to make sure that only one tb_flush request
> > can
> > happen at a given time.
>
> What do you think about just protecting code_gen_buffer with RCU?
I'm not sure of what you mean. Isn't essentially that what the
mechanism I sent (cpu_tcg_sched_work) is doing? I mean, the assumption
is: if any thread is on an RCU read critical section, then code_gen_buffer
cannot be modified. That's why tb_flush is only called after
rcu_synchronize() returns, to make sure that no existing threads
are executing code from the buffer.
Emilio