From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmk4t-00036K-1l for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:08:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmk4n-00033J-UK for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:08:53 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmk4l-000313-Le for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:08:49 -0400 Date: Wed, 21 Sep 2016 12:08:38 -0400 From: "Emilio G. Cota" Message-ID: <20160921160838.GB13385@flamenco> References: <1474289459-15242-1-git-send-email-pbonzini@redhat.com> <1474289459-15242-15-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474289459-15242-15-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 14/16] cpus-common: Introduce async_safe_run_on_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, serge.fdrv@gmail.com, alex.bennee@linaro.org, sergey.fedorov@linaro.org On Mon, Sep 19, 2016 at 14:50:57 +0200, Paolo Bonzini wrote: > We have to run safe work items outside the BQL; for now keep other > work items within the BQL, though this can be changed relatively > easily as a follow-up. > > Signed-off-by: Paolo Bonzini > --- > cpus-common.c | 33 +++++++++++++++++++++++++++++++-- > include/qom/cpu.h | 14 ++++++++++++++ > 2 files changed, 45 insertions(+), 2 deletions(-) > > diff --git a/cpus-common.c b/cpus-common.c > index 6adc982..f7ad534 100644 > --- a/cpus-common.c > +++ b/cpus-common.c > @@ -106,7 +106,7 @@ struct qemu_work_item { > struct qemu_work_item *next; > run_on_cpu_func func; > void *data; > - bool free, done; > + bool free, exclusive, done; > }; > > static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) > @@ -139,6 +139,7 @@ void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data, > wi.data = data; > wi.done = false; > wi.free = false; > + wi.exclusive = false; > > queue_work_on_cpu(cpu, &wi); > while (!atomic_mb_read(&wi.done)) { > @@ -157,6 +158,7 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data) > wi->func = func; > wi->data = data; > wi->free = true; > + wi->exclusive = false; Just a very pedantic nit: in patch 08/19 we don't set wi->done false because there's a malloc0 right above this. So we might want to do the same here. E.