Skip to content
Snippets Groups Projects
user avatar
Paolo Bonzini authored
When two threads (other than the low-priority TCG VCPU thread)
are competing for the iothread lock, a deadlock can happen.  This
is because iothread_requesting_mutex is set to false by the first
thread that gets the mutex, and then the VCPU thread might never
yield from the execution loop.  If iothread_requesting_mutex is
changed from a bool to a counter, the deadlock is fixed.

However, there is another bug in qemu_mutex_lock_iothread that
can be triggered by the new call_rcu thread.  The bug happens
if qemu_mutex_lock_iothread is called before the CPUs are
created.  In that case, first_cpu is NULL and the caller
segfaults in qemu_mutex_lock_iothread.  To fix this, just
do not do the kick if first_cpu is NULL.

Reported-by: default avatarLeon Alrae <leon.alrae@imgtec.com>
Reported-by: default avatarAndreas Gustafsson <gson@gson.org>
Tested-by: default avatarLeon Alrae <leon.alrae@imgtec.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
6b49809c
History
Read the documentation in qemu-doc.html or on http://wiki.qemu-project.org

- QEMU team