On 10/09/2012 03:11 PM, Paolo Bonzini wrote:
>> But no, it's actually impossible. Hotplug may be triggered from a vcpu
>> thread, which clearly it can't be stopped.
>
> Hotplug should always be asynchronous (because that's how hardware
> works), so it should always be possible to delegate the actual work to a
> non-VCPU thread. Or not?
The actual device deletion can happen from a different thread, as long
as you isolate the device before. That's part of the garbage collector
idea.
vcpu thread:
rcu_read_lock
lookup
dispatch
mmio handler
isolate
queue(delete_work)
rcu_read_unlock
worker thread:
process queue
delete_work
synchronize_rcu() / stop_machine()
acquire qemu lock
delete object
drop qemu lock
Compared to the garbage collector idea, this drops fined-grained locking
for the qdev tree, a significant advantage. But it still suffers from
dispatching inside the rcu critical section, which is something we want
to avoid.
I think refcounting is still the best direction, but maybe we can think
of a new idea here.
--
error compiling committee.c: too many arguments to function