summary refs log tree commit diff stats
path: root/scripts/qapi-event.py
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2015-09-28 14:41:58 +0300
committerJuan Quintela <quintela@redhat.com>2015-10-15 08:14:13 +0200
commit60be6340796e66b5ac8aac2d98dde5c79336a89c (patch)
tree104c3d21ffafc2526fa9c85d3fae139776ec9465 /scripts/qapi-event.py
parent92e3762237475407fe03e1ccac6e30612ab96caf (diff)
downloadfocaccia-qemu-60be6340796e66b5ac8aac2d98dde5c79336a89c.tar.gz
focaccia-qemu-60be6340796e66b5ac8aac2d98dde5c79336a89c.zip
migration: fix deadlock
Release qemu global mutex before call synchronize_rcu().
synchronize_rcu() waiting for all readers to finish their critical
sections. There is at least one critical section in which we try
to get QGM (critical section is in address_space_rw() and
prepare_mmio_access() is trying to aquire QGM).

Both functions (migration_end() and migration_bitmap_extend())
are called from main thread which is holding QGM.

Thus there is a race condition that ends up with deadlock:
main thread     working thread
Lock QGA                |
|             Call KVM_EXIT_IO handler
|                       |
|        Open rcu reader's critical section
Migration cleanup bh    |
|                       |
synchronize_rcu() is    |
waiting for readers     |
|            prepare_mmio_access() is waiting for QGM
  \                   /
         deadlock

The patch changes bitmap freeing from direct g_free after synchronize_rcu
to free inside call_rcu.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reported-by: Igor Redko <redkoi@virtuozzo.com>
Tested-by: Igor Redko <redkoi@virtuozzo.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>

CC: Anna Melekhova <annam@virtuozzo.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Amit Shah <amit.shah@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Diffstat (limited to 'scripts/qapi-event.py')
0 files changed, 0 insertions, 0 deletions