On 10/09/2012 02:01 PM, Paolo Bonzini wrote:
>
>> [could we also avoid refcounting by doing the equivalent of
>> stop_machine() during hotunplug?]
>
> That's quite an interesting alternative.
It's somewhat unattractive in that we know how much stop_machine is
hated in Linux. But maybe it makes sense as a transitional path.
Note it's not sufficient to stop vcpu threads, we also have to stop
non-vcpu threads that may be issuing address_space_rw() or family.
But no, it's actually impossible. Hotplug may be triggered from a vcpu
thread, which clearly it can't be stopped. The only two solutions are
Ping's garbage collector thread or refcounting.
The original deadlock was:
read_lock_rcu() / mmap_lock()
lookup device
dispatch
device mmio handler
memory_region_del_subregion()
synchronize_rcu() / mmap_lock()
rcu_read_unlock() / mmap_unlock
stop_machine() is just another name for synchronize_rcu() wrt locking.
--
error compiling committee.c: too many arguments to function