qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 13/15] hotplug: introduce qdev_unplug_complete()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 13/15] hotplug: introduce qdev_unplug_complete() to remove device from views
Date: Thu, 09 Aug 2012 10:00:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

Il 09/08/2012 09:28, liu ping fan ha scritto:
>> >     VCPU thread                    I/O thread
>> > =====================================================================
>> >     get MMIO request
>> >     rcu_read_lock()
>> >     walk memory map
>> >                                    qdev_unmap()
>> >                                    lock_devtree()
>> >                                    ...
>> >                                    unlock_devtree
>> >                                    unref dev -> refcnt=0, free enqueued
>> >     ref()
> No ref() for dev here, while we have ref to flatview+radix in my patches.
> I use rcu to protect radix+flatview+mr refered. As to dev, its ref has
> inc when it is added into mem view -- that is
> memory_region_add_subregion -> memory_region_get() {
> if(atomic_add_and_return()) dev->ref++  }.
> So not until reclaimer of mem view, the dev's ref is hold by mem view.
> In a short word, rcu protect mem view, while device is protected by refcnt.

But the RCU critical section should not include the whole processing of
MMIO, only the walk of the memory map.

And in general I think this is a bit too tricky... I understand not
adding refcounting to all of bottom halves, timers, etc., but if you are
using a device you should have explicit ref/unref pairs.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]