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: Frederic Konrad
Subject: Re: [Qemu-devel] [RFC PATCH V6 13/18] cpu: introduce async_run_safe_work_on_cpu.
Date: Fri, 26 Jun 2015 18:36:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 26/06/2015 18:23, Paolo Bonzini wrote:

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
Ok that makes sense :).

Fred



reply via email to

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