[Top][All Lists]

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

Re: bdrv_drained_begin deadlock with io-threads

From: Dietmar Maurer
Subject: Re: bdrv_drained_begin deadlock with io-threads
Date: Tue, 31 Mar 2020 11:33:22 +0200 (CEST)

> Inside exec.c, there is a race:
> -------
> static bool prepare_mmio_access(MemoryRegion *mr)
> {
>     bool unlocked = !qemu_mutex_iothread_locked();
>     bool release_lock = false;
>     if (unlocked && mr->global_locking) {
>         qemu_mutex_lock_iothread();
> ------
> IMHO, checking for unlocked that way is wrong. Should use some kind
> of _trylock instead?

Answering this myself: above code is correct, because "iothread_locked" is a 
thread local var,
and we want to lock the mutex if we did not already...

reply via email to

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