> 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...