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 <[email protected]>
> ---
> 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.