From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDa9C-0005Bg-Fp for qemu-devel@nongnu.org; Fri, 10 Jul 2015 11:23:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDa98-0004IF-7c for qemu-devel@nongnu.org; Fri, 10 Jul 2015 11:23:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDa97-0004I6-TW for qemu-devel@nongnu.org; Fri, 10 Jul 2015 11:23:26 -0400 References: <1436541553-26576-1-git-send-email-fred.konrad@greensocs.com> <1436541553-26576-4-git-send-email-fred.konrad@greensocs.com> From: Paolo Bonzini Message-ID: <559FE368.40401@redhat.com> Date: Fri, 10 Jul 2015 17:23:20 +0200 MIME-Version: 1.0 In-Reply-To: <1436541553-26576-4-git-send-email-fred.konrad@greensocs.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 3/3] cpus: introduce async_run_safe_work_on_cpu. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fred.konrad@greensocs.com, qemu-devel@nongnu.org, mttcg@greensocs.com Cc: mark.burton@greensocs.com, alex.bennee@linaro.org, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com On 10/07/2015 17:19, fred.konrad@greensocs.com wrote: > +static void flush_queued_safe_work(CPUState *cpu) > +{ > + struct qemu_work_item *wi; > + CPUState *other_cpu; > + > + if (cpu->queued_safe_work_first == NULL) { > + return; > + } > + > + CPU_FOREACH(other_cpu) { > + if (other_cpu->tcg_executing != 0) { > + return; > + } > + } > + > + qemu_mutex_lock(&cpu->work_mutex); > + while ((wi = cpu->queued_safe_work_first)) { > + cpu->queued_safe_work_first = wi->next; > + wi->func(wi->data); Same here. Paolo > + wi->done = true; > + if (wi->free) { > + g_free(wi); > + } > + } > + cpu->queued_safe_work_last = NULL; > + qemu_mutex_unlock(&cpu->work_mutex); > + qemu_cond_broadcast(&qemu_work_cond); > +}