qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH V6 13/18] cpu: introduce async_run_safe_work


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH V6 13/18] cpu: introduce async_run_safe_work_on_cpu.
Date: Fri, 26 Jun 2015 18:23:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1


On 26/06/2015 18:09, Frederic Konrad wrote:
>>>
>>>   +void async_run_safe_work_on_cpu(CPUState *cpu, void (*func)(void
>>> *data),
>>> +                                void *data)
>>> +{
>> Do you need a mutex to protect this data structure?  I would use one
>> even if not strictly necessary, to avoid introducing new BQL-protected
>> structures.
> 
> For the moment it's called by tb_invalidate and tb_flush_safe the second
> lacks a
> tb_lock/unlock which should be added. I don't need an other mutex expect
> if this is
> used elsewhere?

In any case, the locking policy should be documented.

At which point you realize that protecting a CPU's
queued_safe_work_{first,next} fields with the tb_lock is a bit weird. :)
 I would add a mutex inside CPUState, and then later we could also use
it for regular run_on_cpu/async_run_on_cpu.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]