]> git.ipfire.org Git - thirdparty/qemu.git/commit
migration/rdma.c: Swap synchronize_rcu for call_rcu
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Fri, 13 Sep 2019 16:35:07 +0000 (17:35 +0100)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 25 Sep 2019 14:51:19 +0000 (15:51 +0100)
commitd46a4847ca868aaf537df2b87ce07dcbcad6a224
tree05605ee81a7c19d1ef22841d9350ed01902b71c4
parentde8434a35a7871f5f09ff1b22af2dad40a7a0fba
migration/rdma.c: Swap synchronize_rcu for call_rcu

This fixes a deadlock that can occur on the migration source after
a failed RDMA migration;  as the source tries to cleanup it
clears a pair of pointers and uses synchronize_rcu to wait; this
is happening on the main thread.  With the CPUs running
a CPU thread can be an rcu reader and attempt to grab the main lock
(kvm_handle_io->address_space_write->flatview_write->flatview_write_continue->
prepare_mmio_access->qemu_mutex_lock_iothread_impl)

Replace the synchronize_rcu with a call_rcu to postpone the freeing.

Fixes: 74637e6f08fceda98806 ("migration: implement bi-directional RDMA QIOChannel")
( https://bugzilla.redhat.com/show_bug.cgi?id=1746787 )

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190913163507.1403-3-dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
migration/rdma.c