On 21/09/2016 19:03, Emilio G. Cota wrote: >> > - wi = g_malloc0(sizeof(struct qemu_work_item)); >> > - wi->func = func; >> > - wi->data = data; >> > - wi->free = true; >> > - >> > - queue_work_on_cpu(cpu, wi); >> > + do_run_on_cpu(cpu, func, data, &qemu_global_mutex); >> > } > AFAICT this is the only caller of do_run_on_cpu. Is qemu_global_mutex > necessary here? I wonder if we could just use cpu->work_mutex to wait > on a per-cpu work_cond. Contending for a global lock here doesn't > make much sense unless I'm missing something. Furthermore, that change > would allow us to get rid of the atomic accesses to wi.done, which I > dislike.
Yes, this will be a follow up. We pass qemu_global_mutex here for qemu_cond_wait to drop the BQL. But the real solution is to run work item outside the BQL; they don't need it. Paolo