[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 14/16] cpus-common: Introduce async_safe_run_on_
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 14/16] cpus-common: Introduce async_safe_run_on_cpu() |
Date: |
Wed, 21 Sep 2016 18:20:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
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 <address@hidden>
>> ---
>> 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
- [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe, (continued)
[Qemu-devel] [PATCH 16/16] cpus-common: lock-free fast path for cpu_exec_start/end, Paolo Bonzini, 2016/09/19
[Qemu-devel] [PATCH 14/16] cpus-common: Introduce async_safe_run_on_cpu(), Paolo Bonzini, 2016/09/19
Re: [Qemu-devel] [PATCH v7 00/16] cpu-exec: Safe work in quiescent state, no-reply, 2016/09/19
Re: [Qemu-devel] [PATCH v7 00/16] cpu-exec: Safe work in quiescent state, no-reply, 2016/09/19
Re: [Qemu-devel] [PATCH v7 00/16] cpu-exec: Safe work in quiescent state, Emilio G. Cota, 2016/09/21