[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 07/73] cpu: make per-CPU locks an alias of th
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v6 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode |
Date: |
Wed, 20 Feb 2019 08:12:26 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 1/29/19 4:47 PM, Emilio G. Cota wrote:
> Before we can switch from the BQL to per-CPU locks in
> the CPU loop, we have to accommodate the fact that TCG
> rr mode (i.e. !MTTCG) cannot work with separate per-vCPU
> locks. That would lead to deadlock since we need a single
> lock/condvar pair on which to wait for events that affect
> any vCPU, e.g. in qemu_tcg_rr_wait_io_event.
>
> At the same time, we are moving towards an interface where
> the BQL and CPU locks are independent, and the only requirement
> is that the locking order is respected, i.e. the BQL is
> acquired first if both locks have to be held at the same time.
>
> In this patch we make the BQL a recursive lock under the hood.
> This allows us to (1) keep the BQL and CPU locks interfaces
> separate, and (2) use a single lock for all vCPUs in TCG rr mode.
>
> Note that the BQL's API (qemu_mutex_lock/unlock_iothread) remains
> non-recursive.
>
> Signed-off-by: Emilio G. Cota <address@hidden>
> ---
> include/qom/cpu.h | 2 +-
> cpus-common.c | 2 +-
> cpus.c | 90 +++++++++++++++++++++++++++++++++++++++++------
> qom/cpu.c | 3 +-
> stubs/cpu-lock.c | 6 ++--
> 5 files changed, 86 insertions(+), 17 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
r~