Hi, I've picked up this work from Sergey and will be taking it forward from now on.
Apart from adding my s-o-b tags to all the patches there are only two changes. Both are to wait_safe_cpu_work function to prevent dead-lock conditions. First I have added the macro can_wait_for_safe() which compiles away to 0 on SoftMMU. This will be tweaked in later MTTCG work. Second I have ensured we signal the qemu_exclusive_cond conditional if tcg_pending_threads is 0 by the time to we want to sleep waiting for safe work to run. Finally I've added another patch at the end of the series which converts everything to a GArray. The main driver was my MTTCG test case which was particularly stressing of memory as multi-thousand queues of flushes backed up. I've since mitigated that with other changes to the cputlb code but it does have the advantage of avoiding bouncing the lock as we go through the queue. If people aren't happy with the change we can always drop it. I'm keen to get this work merged as soon as the tree re-opens so any additional comments will be helpful. I've been using this patch set along with the hot-path tweaks in Paolo's tree as a base for the ongoing MTTCG patches. When I post the next set of patches they will be based of this tree: https://github.com/stsquad/qemu/tree/mttcg/async-safe-work-v5 Which is: - v2.7.0-rc0 - plus Reduce lock contention on TCG hot-path (v5, Paolo's tree) - plus cpu-exec: Safe work in quiescent state (v5, this series) Alex Bennée (3): atomic: introduce atomic_dec_fetch. cpus: pass CPUState to run_on_cpu helpers cpu-exec: replace cpu->queued_work with GArray Sergey Fedorov (10): cpus: Move common code out of {async_,}run_on_cpu() cpus: Wrap mutex used to protect CPU work cpus: Rename flush_queued_work() linux-user: Use QemuMutex and QemuCond linux-user: Rework exclusive operation mechanism linux-user: Add qemu_cpu_is_self() and qemu_cpu_kick() linux-user: Support CPU work queue bsd-user: Support CPU work queue cpu-exec-common: Introduce async_safe_run_on_cpu() tcg: Make tb_flush() thread safe bsd-user/main.c | 16 +++++ cpu-exec-common.c | 157 +++++++++++++++++++++++++++++++++++++++++++++ cpu-exec.c | 12 +--- cpus.c | 108 ++++++------------------------- hw/i386/kvm/apic.c | 3 +- hw/i386/kvmvapic.c | 6 +- hw/ppc/ppce500_spin.c | 31 +++------ hw/ppc/spapr.c | 6 +- hw/ppc/spapr_hcall.c | 17 ++--- include/exec/exec-all.h | 31 +++++++++ include/qemu/atomic.h | 4 ++ include/qom/cpu.h | 30 ++++++--- kvm-all.c | 21 ++---- linux-user/main.c | 94 +++++++++++++++++---------- target-i386/helper.c | 19 +++--- target-i386/kvm.c | 6 +- target-s390x/cpu.c | 4 +- target-s390x/cpu.h | 7 +- target-s390x/kvm.c | 98 ++++++++++++++-------------- target-s390x/misc_helper.c | 4 +- translate-all.c | 17 +++-- 21 files changed, 420 insertions(+), 271 deletions(-) -- 2.7.4