Am 25.11.2015 um 14:26 schrieb Paolo Bonzini:
On 25/11/2015 13:31, David Engraf wrote:
Hi Paolo,
please check the new version. I removed changing the iothread_locked
variable. But I still need to set the correct value of iothread_locked
when using qemu_cond_wait.
No, you don't. Who is reading iothread_locked during
qemu_cond_wait_iothread? No one, because it is a thread-local variable
whose address is never taken.
prepare_mmio_access is reading iothread_locked by using
qemu_mutex_iothread_locked after qemu_tcg_wait_io_event calls
qemu_cond_wait. All one the same thread.
qemu_tcg_cpu_thread_fn
-> qemu_tcg_wait_io_event
-> qemu_cond_wait acquires the mutex
qemu_tcg_cpu_thread_fn
-> tcg_exec_all -> tcg_cpu_exec -> cpu_exec
-> cpu_exec ends up in calling prepare_mmio_access
David