fred.kon...@greensocs.com writes: > From: KONRAD Frederic <fred.kon...@greensocs.com> > > This is the async_safe_work introduction bit of the Multithread TCG work. > Rebased on current upstream (6169b60285fe1ff730d840a49527e721bfb30899). > > (Currently untested as I need to rebase MTTCG first.) > > It can be cloned here: > http://git.greensocs.com/fkonrad/mttcg.git branch async_work_v3 > > The first patch introduces a mutex to protect the existing queued_work_* > CPUState members against multiple (concurent) access. > > The second patch introduces a tcg_exec_flag which will be 1 when we are inside > cpu_exec(), -1 when we must not enter the cpu execution and 0 when we are > allowed to do so. This is required as safe work need to be sure that's all > vCPU > are outside cpu_exec(). > > The last patch introduces async_safe_work. It allows to add some work which > will > be done asynchronously but only when all vCPUs are outside cpu_exec(). The tcg > thread will wait that no vCPUs have any pending safe work before reentering > cpu-exec(). > > Changes V2 -> V3: > * Check atomically we are not in the executiong loop to fix the race > condition > which might happen. > Changes V1 -> V2: > * Release the lock while running the callback for both async and safe work. > > KONRAD Frederic (3): > cpus: protect queued_work_* with work_mutex. > cpus: add tcg_exec_flag. > cpus: introduce async_run_safe_work_on_cpu.
Also currently breaks a lot of targets: https://travis-ci.org/stsquad/qemu/builds/71797143 > > cpu-exec.c | 10 ++++ > cpus.c | 160 > ++++++++++++++++++++++++++++++++++++++++-------------- > include/qom/cpu.h | 57 +++++++++++++++++++ > qom/cpu.c | 20 +++++++ > 4 files changed, 207 insertions(+), 40 deletions(-) -- Alex Bennée