qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] virtio-ccw: remove qdev_unparent in unplug


From: Christian Borntraeger
Subject: Re: [Qemu-devel] [PATCH 1/3] virtio-ccw: remove qdev_unparent in unplug routing
Date: Mon, 25 Feb 2013 09:09:25 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

On 25/02/13 08:55, Paolo Bonzini wrote:
> 
>> Another thing is, that  qdev_free looks now different, some days ago
>> it also did an unref. As far as I can see the object_unparent in
>> virtio-ccw was always the wrong thing to do.
> 
> object_unparent is "almost" idempotent, i.e. idempotent as long as it does
> not cause the last reference to go away.  So, doing an object_unparent
> before qdev_free was not wrong when qdev_free did an object_unref.


Hmm, the old sequence was 

     object_unparent(OBJECT(dev));
     qdev_free(dev) ---+
                       |
                       V
...
             object_unparent(OBJECT(dev));  now the last reference is gone, 
object is freed
             object_unref(OBJECT(dev));     now the reference of a deleted 
object becomes -1
...

Isnt that a problem in itself that we modify a reference counter in an deleted 
object?



> 
> I think qdev_free is better, unless we want to change all of them
> at the same time.


Ok, so we leave the patch as is.

Christian




reply via email to

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