Skip to contentSkip to conversation

device_add error handling regressed in v1.5.0

Qemu-devel Markus Armbruster 2 participants 4 messages Jan 17, 2014 – Jan 20, 2014

lore
Share & tools
lore
#0 lore raw

Watch this:

    $ upstream-qemu -nodefaults -S -display none -monitor stdio
    QEMU 1.7.50 monitor - type 'help' for more information
    (qemu) device_add e1000,netdev=xxx
    Property 'e1000.netdev' can't find value 'xxx'
    (qemu) info qtree
    bus: main-system-bus
      type System
      dev: hpet, id ""
        gpio-in 2
        gpio-out 1
        timers = 3
        msi = off
        hpet-intcap = 4
        irq 32
        mmio 00000000fed00000/0000000000000400
      dev: ioapic, id ""
        gpio-in 24
        irq 0
        mmio 00000000fec00000/0000000000001000
      dev: i440FX-pcihost, id ""
        pci-hole64-size = 16777216.000T
        short_root_bus = 0
        irq 0
        bus: pci.0
          type PCI
          dev: e1000, id ""
            mac = 00:00:00:00:00:00
            vlan = <null>
            netdev = <null>
            bootindex = -1
            autonegotiation = on
            mitigation = on
            addr = <unset>
            romfile = <null>
            rombar = 1
            multifunction = off
            command_serr_enable = on
    Segmentation fault (core dumped)

Even though device_add failed, it still created a node in the qtree!

Same issue observed with scsi-hd. Looks like a qdev problem, not a device problem.

git-bisect blames this one:

e0a83fc2c1582dc8d4453849852ebe6c258b7c3a is the first bad commit commit e0a83fc2c1582dc8d4453849852ebe6c258b7c3a

Author: Paolo Bonzini <[email protected]>
Date:   Tue Apr 2 15:50:00 2013 +0200

qom: do nothing on unparent of object without parent

Otherwise, device_unparent will fail to get a canonical path of the object.

Message-id: [email protected]

#1 lore raw

Il 17/01/2014 11:23, Markus Armbruster ha scritto:

Quoted 5 lines

e0a83fc2c1582dc8d4453849852ebe6c258b7c3a is the first bad commit commit e0a83fc2c1582dc8d4453849852ebe6c258b7c3a

Author: Paolo Bonzini <[email protected]>
Date:   Tue Apr 2 15:50:00 2013 +0200
Quoted 9 lines

qom: do nothing on unparent of object without parent

Otherwise, device_unparent will fail to get a canonical path of the object.

Message-id: [email protected]

I think Amos had a fix for this.

Paolo

#2 lore raw
Quoted 8 lines · Paolo Bonzini

Il 17/01/2014 11:23, Markus Armbruster ha scritto:

Quoted 7 lines

Watch this:

    $ upstream-qemu -nodefaults -S -display none -monitor stdio
    QEMU 1.7.50 monitor - type 'help' for more information
    (qemu) device_add e1000,netdev=xxx
    Property 'e1000.netdev' can't find value 'xxx'
    (qemu) info qtree

[...]

Quoted 19 lines
Quoted 19 lines

Segmentation fault (core dumped)

Even though device_add failed, it still created a node in the qtree!

Same issue observed with scsi-hd. Looks like a qdev problem, not a device problem.

git-bisect blames this one:

e0a83fc2c1582dc8d4453849852ebe6c258b7c3a is the first bad commit commit e0a83fc2c1582dc8d4453849852ebe6c258b7c3a

Author: Paolo Bonzini <[email protected]>
Date:   Tue Apr 2 15:50:00 2013 +0200

qom: do nothing on unparent of object without parent

Otherwise, device_unparent will fail to get a canonical path of the object.

Quoted 6 lines
Quoted 4 lines

Message-id: [email protected]

I think Amos had a fix for this.

Amos, do you?

#3 lore raw
Quoted 30 lines · Markus Armbruster
Quoted 8 lines · Paolo Bonzini

Il 17/01/2014 11:23, Markus Armbruster ha scritto:

Quoted 7 lines

Watch this:

    $ upstream-qemu -nodefaults -S -display none -monitor stdio
    QEMU 1.7.50 monitor - type 'help' for more information
    (qemu) device_add e1000,netdev=xxx
    Property 'e1000.netdev' can't find value 'xxx'
    (qemu) info qtree

[...]

Quoted 19 lines
Quoted 19 lines

Segmentation fault (core dumped)

Even though device_add failed, it still created a node in the qtree!

Same issue observed with scsi-hd. Looks like a qdev problem, not a device problem.

git-bisect blames this one:

e0a83fc2c1582dc8d4453849852ebe6c258b7c3a is the first bad commit commit e0a83fc2c1582dc8d4453849852ebe6c258b7c3a

Author: Paolo Bonzini <[email protected]>
Date:   Tue Apr 2 15:50:00 2013 +0200

qom: do nothing on unparent of object without parent

Otherwise, device_unparent will fail to get a canonical path of the object.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Message-id: [email protected]

I think Amos had a fix for this.

Amos, do you?

Found it: "[PATCH v2] qdev: add the device to the QOM tree before using it to set a link" seems to fix it.