On Fri, Feb 08, 2019 at 14:58:40 +0000, Alex Bennée wrote: > > Emilio G. Cota <c...@braap.org> writes: > > > Some async jobs do not need the BQL. > > > > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > > Signed-off-by: Emilio G. Cota <c...@braap.org> (snip) > So we now have a locking/scheduling hierarchy that goes: > > - run_on_cpu - synchronously wait until target cpu has done the thing > - async_run_on_cpu - schedule work on cpu at some point (soon) resources > protected by BQL > - async_run_on_cpu_no_bql - as above but only protected by cpu_lock
This one doesn't hold any locks when calling the passed function, though. The CPU lock is just to serialise the queueing/dequeueing. > - async_safe_run_on_cpu - as above but locking (probably) not required as > everything else asleep > > So the BQL is only really needed to manipulate data that is shared > across multiple vCPUs like device emulation or other state shared across > multiple vCPUS. For all "just do it over there" cases we should be able > to stick to cpu locks. > > It would be nice if we could expand the documentation in > multi-thread-tcg.txt to cover this in long form for people trying to > work out the best thing to use. I think the documentation in the functions is probably enough -- they point to each other, so figuring out what to use should be pretty easy. Besides, these functions aren't MTTCG-only, they're QEMU-wide, so perhaps their documentation should go in a different file? Since this can be done later, I'll post a v7 with the other changes you suggested. > Reviewed-by: Alex Bennée <alex.ben...@linaro.org> Thanks! Emilio