Skip to contentSkip to conversation

virtio-ccw: remove qdev_unparent in unplug routing

PATCH Alexander Graf 3 participants 5 messages Mar 8, 2013 – Mar 11, 2013 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 34 lines · Christian Borntraeger
Quoted 23 lines · Paolo Bonzini

Il 25/02/2013 09:09, Christian Borntraeger ha scritto:

Quoted 6 lines

Hmm, the old sequence was

    object_unparent(OBJECT(dev));
    qdev_free(dev) ---+
                      |
                      V
Quoted 6 lines

...
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?

The second object_unparent should do nothing. So before you had:

object_unparent(OBJECT(dev)); leaves refcount=1
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); do nothing
object_unref(OBJECT(dev)); refcount=0, object freed

Quoted 8 lines

After the object_unref was removed you had:

object_unparent(OBJECT(dev)); refcount=0, object freed
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); dangling pointer!

Quoted 1 line

Got it. Thanks

So is the patch valid?

Alex

#5 lore raw
Quoted 37 lines · On Fri, 8 Mar 2013 21:11:13 +0100 Alexander Graf <[email protected]> wrote:
Quoted 34 lines · Christian Borntraeger
Quoted 31 lines · Paolo Bonzini

Il 25/02/2013 09:09, Christian Borntraeger ha scritto:

Quoted 6 lines

Hmm, the old sequence was

    object_unparent(OBJECT(dev));
    qdev_free(dev) ---+
                      |
                      V
Quoted 6 lines

...
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?

The second object_unparent should do nothing. So before you had:

object_unparent(OBJECT(dev)); leaves refcount=1
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); do nothing
object_unref(OBJECT(dev)); refcount=0, object freed

After the object_unref was removed you had:

object_unparent(OBJECT(dev)); refcount=0, object freed
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); dangling pointer!

Quoted 3 lines
Quoted 1 line

Got it. Thanks

So is the patch valid?

To my understanding, yes.

Quoted 4 lines

Alex

#6 lore raw

Il 11/03/2013 13:04, Cornelia Huck ha scritto:

Quoted 40 lines
Quoted 37 lines · On Fri, 8 Mar 2013 21:11:13 +0100 Alexander Graf <[email protected]> wrote:
Quoted 34 lines · Christian Borntraeger
Quoted 31 lines · Paolo Bonzini

Il 25/02/2013 09:09, Christian Borntraeger ha scritto:

Quoted 6 lines

Hmm, the old sequence was

    object_unparent(OBJECT(dev));
    qdev_free(dev) ---+
                      |
                      V
Quoted 6 lines

...
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?

The second object_unparent should do nothing. So before you had:

object_unparent(OBJECT(dev)); leaves refcount=1
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); do nothing
object_unref(OBJECT(dev)); refcount=0, object freed

After the object_unref was removed you had:

object_unparent(OBJECT(dev)); refcount=0, object freed
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); dangling pointer!

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Got it. Thanks

So is the patch valid?

To my understanding, yes.

Yes, except that the "fixed a crash" part in the commit message is probably no longer accurate. No big deal. :)

Paolo

#7 lore raw
Quoted 38 lines · Paolo Bonzini

Il 11/03/2013 13:04, Cornelia Huck ha scritto:

Quoted 37 lines
Quoted 34 lines · On Fri, 8 Mar 2013 21:11:13 +0100 Alexander Graf<[email protected]> wrote:
Quoted 32 lines · Christian Borntraeger
Quoted 30 lines · Paolo Bonzini

Il 25/02/2013 09:09, Christian Borntraeger ha scritto:

Quoted 6 lines

Hmm, the old sequence was

     object_unparent(OBJECT(dev));
     qdev_free(dev) ---+
                       |
                       V
Quoted 6 lines

...
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?

The second object_unparent should do nothing. So before you had:

object_unparent(OBJECT(dev)); leaves refcount=1
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); do nothing
object_unref(OBJECT(dev)); refcount=0, object freed

After the object_unref was removed you had:

object_unparent(OBJECT(dev)); refcount=0, object freed
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); dangling pointer!

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Got it. Thanks

So is the patch valid?

To my understanding, yes.

Yes, except that the "fixed a crash" part in the commit message is probably no longer accurate. No big deal. :)

Ok, Connie could you please include it in your next pull then please?

Alex

#8 lore raw
Quoted 39 lines · On Mon, 11 Mar 2013 13:22:45 +0100 Alexander Graf <[email protected]> wrote:
Quoted 38 lines · Paolo Bonzini

Il 11/03/2013 13:04, Cornelia Huck ha scritto:

Quoted 37 lines
Quoted 34 lines · On Fri, 8 Mar 2013 21:11:13 +0100 Alexander Graf<[email protected]> wrote:
Quoted 32 lines · Christian Borntraeger
Quoted 30 lines · Paolo Bonzini

Il 25/02/2013 09:09, Christian Borntraeger ha scritto:

Quoted 6 lines

Hmm, the old sequence was

     object_unparent(OBJECT(dev));
     qdev_free(dev) ---+
                       |
                       V
Quoted 6 lines

...
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?

The second object_unparent should do nothing. So before you had:

object_unparent(OBJECT(dev)); leaves refcount=1
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); do nothing
object_unref(OBJECT(dev)); refcount=0, object freed

After the object_unref was removed you had:

object_unparent(OBJECT(dev)); refcount=0, object freed
qdev_free(dev) ---+
|
V
object_unparent(OBJECT(dev)); dangling pointer!

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Got it. Thanks

So is the patch valid?

To my understanding, yes.

Yes, except that the "fixed a crash" part in the commit message is probably no longer accurate. No big deal. :)

Ok, Connie could you please include it in your next pull then please?

Sure, will do.

Quoted 4 lines

Alex