Received: from eggs.gnu.org ([2001:4830:134:3::10]:56877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkG6-0005FJ-S4 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:20:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmkG2-00070F-FX for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:20:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmkG2-00070B-8T for qemu-devel@nongnu.org; Wed, 21 Sep 2016 12:20:26 -0400 References: <1474289459-15242-1-git-send-email-pbonzini@redhat.com> <1474289459-15242-15-git-send-email-pbonzini@redhat.com> <20160921160838.GB13385@flamenco> From: Paolo Bonzini Message-ID: Date: Wed, 21 Sep 2016 18:20:21 +0200 MIME-Version: 1.0 In-Reply-To: <20160921160838.GB13385@flamenco> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: "Emilio G. Cota" Cc: qemu-devel@nongnu.org, serge.fdrv@gmail.com, alex.bennee@linaro.org, sergey.fedorov@linaro.org On 21/09/2016 18:08, Emilio G. Cota wrote: > 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. > Ok. Paolo