Strange monitor behavior related to hotplug commands

33 views
Skip to first unread message

Dimitris Aragiorgis

unread,
Jan 24, 2014, 6:40:11 AM1/24/14
to qemu-...@nongnu.org, ganeti...@googlegroups.com, synnef...@googlegroups.com

Hi,

After having heavily used device_add/netdev_add lately with QEMU 1.7, we
encountered the following strange behavior:


1) Get network/PCI configuration for a VM

# echo info network | socat STDIO UNIX-CONNECT:/path/to/monitor/socket
QEMU 1.7.0 monitor - type 'help' for more information
(qemu) info network
hotnic-42932f20-pci-5: index=0,type=nic,model=virtio-net-pci,macaddr=aa:00:08:28:1b:3c
\ hotnic-42932f20-pci-5: index=0,type=tap,fd=8
hotnic-ab323482-pci-6: index=0,type=nic,model=virtio-net-pci,macaddr=aa:0c:f8:9d:d9:52
\ hotnic-ab323482-pci-6: index=0,type=tap,fd=9
(qemu)

# echo info pci | socat STDIO UNIX-CONNECT:/path/to/monitor/socket
QEMU 1.7.0 monitor - type 'help' for more information
(qemu) info pci
Bus 0, device 0, function 0:
Host bridge: PCI device 8086:1237
id ""
Bus 0, device 1, function 0:
ISA bridge: PCI device 8086:7000
id ""
Bus 0, device 1, function 1:
IDE controller: PCI device 8086:7010
BAR4: I/O at 0xc0c0 [0xc0cf].
id ""
Bus 0, device 1, function 2:
USB controller: PCI device 8086:7020
IRQ 11.
BAR4: I/O at 0xc0a0 [0xc0bf].
id ""
Bus 0, device 1, function 3:
Bridge: PCI device 8086:7113
IRQ 9.
id ""
Bus 0, device 2, function 0:
VGA controller: PCI device 1013:00b8
BAR0: 32 bit prefetchable memory at 0xfc000000 [0xfdffffff].
BAR1: 32 bit memory at 0xfebf3000 [0xfebf3fff].
BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
id ""
Bus 0, device 3, function 0:
Class 0255: PCI device 1af4:1002
IRQ 11.
BAR0: I/O at 0xc080 [0xc09f].
id ""
Bus 0, device 4, function 0:
SCSI controller: PCI device 1af4:1001
IRQ 11.
BAR0: I/O at 0xc000 [0xc03f].
BAR1: 32 bit memory at 0xfebf2000 [0xfebf2fff].
id "hotdisk-1d455fed-pci-4"
Bus 0, device 5, function 0:
Ethernet controller: PCI device 1af4:1000
IRQ 10.
BAR0: I/O at 0xc060 [0xc07f].
BAR1: 32 bit memory at 0xfebf1000 [0xfebf1fff].
BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
id "hotnic-42932f20-pci-5"
Bus 0, device 6, function 0:
Ethernet controller: PCI device 1af4:1000
IRQ 10.
BAR0: I/O at 0xc040 [0xc05f].
BAR1: 32 bit memory at 0xfebf0000 [0xfebf0fff].
BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
id "hotnic-ab323482-pci-6"
(qemu)


2) Monitor states that it has two Ethernet controllers (devices at PCI 5 and 6)
with the corresponding netdev.

3) Try to remove the one on PCI 6 with id hotnic-ab323482-pci-6

# echo device_del hotnic-ab323482-pci-6 | socat STDIO UNIX-CONNECT:/path/to/monitor/socket/
QEMU 1.7.0 monitor - type 'help' for more information
(qemu) device_del hotnic-ab323482-pci-6
(qemu)

4) Monitor output points out that `device_del` succeeded.

5) *Still* info pci/network returns the same as above!

6) Try to remove the corresponding netdev:

# echo netdev_del hotnic-ab323482-pci-6 | socat STDIO UNIX-CONNECT:/path/to/monitor/socket
QEMU 1.7.0 monitor - type 'help' for more information
(qemu) netdev_del hotnic-ab323482-pci-6
Device 'hotnic-ab323482-pci-6' not found
(qemu)

7) Monitor output points out that `netdev_del` has failed because the
corresponding device (not netdev?) ID was not found!

8) *Still* info pci/network returns the same as above!


Any ideas why this is happening? Is there another way to get
further debug info or even another monitor command to work this around?

Random thought: Is there any chance that a previous back-to-back
netdev_add/device_add command has actually failed (due to a race or
something) but the corresponding configuration not properly updated?


Thanks in advance,
dimara


PS: Has commit 03060d on 1.6.2 anything to do with the aforementioned?

qdev-monitor: Unref device when device_add fails

qdev_device_add() leaks the created device upon failure. I suspect this
problem crept in because qdev_free() unparents the device but does not
drop a reference - confusing name.
signature.asc
Reply all
Reply to author
Forward
0 new messages