qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] accel/tcg/cputlb: avoid recursive BQL (fixes #1


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] accel/tcg/cputlb: avoid recursive BQL (fixes #1706296)
Date: Thu, 21 Sep 2017 12:09:30 +0100

On 21 September 2017 at 12:06, Alex Bennée <address@hidden> wrote:
> The mmio path (see exec.c:prepare_mmio_access) already protects itself
> against recursive locking and it makes sense to do the same for
> io_readx/writex. Otherwise any helper running in the BQL context will
> assert when it attempts to write to device memory as in the case of
> the bug report.
>
> Signed-off-by: Alex Bennée <address@hidden>
> CC: Richard Jones <address@hidden>
> CC: Paolo Bonzini <address@hidden>

Seems worth:
Cc: address@hidden

> ---
>  accel/tcg/cputlb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index e72415a882..bcbcc4db6c 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -765,7 +765,7 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry 
> *iotlbentry,
>
>      cpu->mem_io_vaddr = addr;
>
> -    if (mr->global_locking) {
> +    if (mr->global_locking && !qemu_mutex_iothread_locked()) {
>          qemu_mutex_lock_iothread();
>          locked = true;
>      }
> @@ -800,7 +800,7 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry 
> *iotlbentry,
>      cpu->mem_io_vaddr = addr;
>      cpu->mem_io_pc = retaddr;
>
> -    if (mr->global_locking) {
> +    if (mr->global_locking && !qemu_mutex_iothread_locked()) {
>          qemu_mutex_lock_iothread();
>          locked = true;
>      }
> --
> 2.14.1

Seems to fix the similar problem that I ran into with my work-in-progress
v8M blxns/secure-return code.

Reviewed-by: Peter Maydell <address@hidden>

thanks
-- PMM



reply via email to

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