Bug 1368033

Summary: RNG device which connected to pci-bridge didn't deleted when ran command "device_del rng0"
Product: Red Hat Enterprise Linux 7 Reporter: jingzhao <jinzhao>
Component: qemu-kvm-rhevAssignee: Amit Shah <amit.shah>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: chayang, juzhang, knoel, pagupta, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-23 20:45:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description jingzhao 2016-08-18 07:42:34 UTC
Description of problem:
RNG device which connected to pci-bridge didn't deleted when ran command "device_del rng0"
Version-Release number of selected component (if applicable):
host-kernel:3.10.0-492.el7.x86_64
qemu-kvm-rhev-2.6.0-20.el7.x86_64

How reproducible:
3/3

Steps to Reproduce:
1. Boot guest with rng device which connected to pci-bridge
/usr/libexec/qemu-kvm \
-M pc \
-cpu SandyBridge \
-nodefaults -rtc base=utc \
-m 4G \
-smp 2,sockets=2,cores=1,threads=1 \
-enable-kvm \
-name rhel7.3 \
-uuid 990ea161-6b67-47b2-b803-19fb01d30d12 \
-smbios type=1,manufacturer='Red Hat',product='RHEV Hypervisor',version=el6,serial=koTUXQrb,uuid=feebc8fd-f8b0-4e75-abc3-e63fcdb67170 \
-k en-us \
-nodefaults \
-serial unix:/tmp/serial0,server,nowait \
-boot menu=on \
-bios /usr/share/seabios/bios.bin \
-chardev file,path=/home/pci-bridge/seabios.log,id=seabios \
-device isa-debugcon,chardev=seabios,iobase=0x402 \
-qmp tcp:0:6666,server,nowait \
-device pci-bridge,bus=pci.0,id=bridge1,chassis_nr=1 \
-drive file=/home/pci-bridge/big.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1,bus=bridge1,addr=0x1 \
-device virtio-net-pci,netdev=tap10,mac=9a:6a:6b:6c:6d:6e,bus=bridge1,addr=0x2 -netdev tap,id=tap10 \
-device VGA,id=video,bus=bridge1,addr=0x3 \
-vnc :2 \
-device virtio-rng-pci,id=rng0,bus=bridge1,addr=0x4 \
-device pci-bridge,bus=pci.0,id=bridge9,chassis_nr=9 \
-monitor stdio \

2. check the rng device in hmp
(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 0xe000 [0xe00f].
      id ""
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 9.
      id ""
  Bus  0, device   2, function 0:
    PCI bridge: PCI device 1b36:0001
      IRQ 10.
      BUS 0.
      secondary bus 1.
      subordinate bus 1.
      IO range [0xd000, 0xdfff]
      memory range [0xfe800000, 0xfe9fffff]
      prefetchable memory range [0xfb000000, 0xfdffffff]
      BAR0: 64 bit memory at 0xfea00000 [0xfea000ff].
      id "bridge1"
  Bus  1, device   1, function 0:
    SCSI controller: PCI device 1af4:1001
      IRQ 11.
      BAR0: I/O at 0xd000 [0xd03f].
      BAR1: 32 bit memory at 0xfe850000 [0xfe850fff].
      BAR4: 64 bit prefetchable memory at 0xfc000000 [0xfc7fffff].
      id "virtio-disk0"
  Bus  1, device   2, function 0:
    Ethernet controller: PCI device 1af4:1000
      IRQ 11.
      BAR0: I/O at 0xd040 [0xd05f].
      BAR1: 32 bit memory at 0xfe851000 [0xfe851fff].
      BAR4: 64 bit prefetchable memory at 0xfc800000 [0xfcffffff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe].
      id ""
  Bus  1, device   3, function 0:
    VGA controller: PCI device 1234:1111
      BAR0: 32 bit prefetchable memory at 0xfb000000 [0xfbffffff].
      BAR2: 32 bit memory at 0xfe852000 [0xfe852fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id "video"
  Bus  1, device   4, function 0:
    Class 0255: PCI device 1af4:1005
      IRQ 10.
      BAR0: I/O at 0xd060 [0xd07f].
      BAR4: 64 bit prefetchable memory at 0xfd000000 [0xfd7fffff].
      id "rng0"
  Bus  0, device   3, function 0:
    PCI bridge: PCI device 1b36:0001
      IRQ 11.
      BUS 0.
      secondary bus 2.
      subordinate bus 2.
      IO range [0xc000, 0xcfff]
      memory range [0xfe600000, 0xfe7fffff]
      prefetchable memory range [0xfe000000, 0xfe1fffff]
      BAR0: 64 bit memory at 0xfea01000 [0xfea010ff].
      id "bridge9"
(qemu) info qtree
bus: main-system-bus
  type System
  dev: kvm-ioapic, id ""
    gpio-in "" 24
    gsi_base = 0 (0x0)
    mmio 00000000fec00000/0000000000001000
  dev: i440FX-pcihost, id ""
    pci-hole64-size = 18446744073709551615 (16 EiB)
    short_root_bus = 0 (0x0)
    bus: pci.0
      type PCI
      dev: pci-bridge, id "bridge9"
        chassis_nr = 9 (0x9)
        msi = true
        shpc = true
        addr = 03.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        class PCI bridge, addr 00:03.0, pci id 1b36:0001 (sub 0000:0000)
        bar 0: mem at 0xfea01000 [0xfea010ff]
        bus: bridge9
          type PCI
      dev: pci-bridge, id "bridge1"
        chassis_nr = 1 (0x1)
        msi = true
        shpc = true
        addr = 02.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        class PCI bridge, addr 00:02.0, pci id 1b36:0001 (sub 0000:0000)
        bar 0: mem at 0xfea00000 [0xfea000ff]
        bus: bridge1
          type PCI
          dev: virtio-rng-pci, id "rng0"
            virtio-pci-bus-master-bug-migration = false
            disable-legacy = "off"
            disable-modern = false
            migrate-extra = true
            modern-pio-notify = false
            x-disable-pcie = false
            addr = 04.0
            romfile = ""
            rombar = 1 (0x1)
            multifunction = false
            command_serr_enable = true
            x-pcie-lnksta-dllla = true
            class Class 00ff, addr 01:04.0, pci id 1af4:1005 (sub 1af4:0004)
            bar 0: i/o at 0xd060 [0xd07f]
            bar 4: mem at 0xfd000000 [0xfd7fffff]
            bus: virtio-bus
              type virtio-pci-bus
              dev: virtio-rng-device, id ""
                max-bytes = 9223372036854775807 (0x7fffffffffffffff)
                period = 65536 (0x10000)
                indirect_desc = true
                event_idx = true
                notify_on_empty = true
                any_layout = true

3. In guest, check the rng device

[root@localhost ~]# lspci  -vvv -t
-[0000:00]-+-00.0  Intel Corporation 440FX - 82441FX PMC [Natoma]
           +-01.0  Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
           +-01.1  Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
           +-01.3  Intel Corporation 82371AB/EB/MB PIIX4 ACPI
           +-02.0-[01]--+-01.0  Red Hat, Inc Virtio block device
           |            +-02.0  Red Hat, Inc Virtio network device
           |            +-03.0  Device 1234:1111
           |            \-04.0  Red Hat, Inc Virtio RNG
           \-03.0-[02]--

4. (qemu) device_del rng0 
(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 0xe000 [0xe00f].
      id ""
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 9.
      id ""
  Bus  0, device   2, function 0:
    PCI bridge: PCI device 1b36:0001
      IRQ 10.
      BUS 0.
      secondary bus 1.
      subordinate bus 1.
      IO range [0xd000, 0xdfff]
      memory range [0xfe800000, 0xfe9fffff]
      prefetchable memory range [0xfb000000, 0xfdffffff]
      BAR0: 64 bit memory at 0xfea00000 [0xfea000ff].
      id "bridge1"
  Bus  1, device   1, function 0:
    SCSI controller: PCI device 1af4:1001
      IRQ 11.
      BAR0: I/O at 0xd000 [0xd03f].
      BAR1: 32 bit memory at 0xfe850000 [0xfe850fff].
      BAR4: 64 bit prefetchable memory at 0xfc000000 [0xfc7fffff].
      id "virtio-disk0"
  Bus  1, device   2, function 0:
    Ethernet controller: PCI device 1af4:1000
      IRQ 11.
      BAR0: I/O at 0xd040 [0xd05f].
      BAR1: 32 bit memory at 0xfe851000 [0xfe851fff].
      BAR4: 64 bit prefetchable memory at 0xfc800000 [0xfcffffff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe].
      id ""
  Bus  1, device   3, function 0:
    VGA controller: PCI device 1234:1111
      BAR0: 32 bit prefetchable memory at 0xfb000000 [0xfbffffff].
      BAR2: 32 bit memory at 0xfe852000 [0xfe852fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id "video"
  Bus  1, device   4, function 0:
    Class 0255: PCI device 1af4:1005
      IRQ 10.
      BAR0: I/O at 0xd060 [0xd07f].
      BAR4: 64 bit prefetchable memory at 0xfd000000 [0xfd7fffff].
      id "rng0"

In guest:
[root@localhost ~]# lspci  -vvv -t
pcilib: Cannot open /sys/bus/pci/devices/0000:01:04.0/config
lspci: Unable to read the standard configuration space header of device 0000:01:04.0
-[0000:00]-+-00.0  Intel Corporation 440FX - 82441FX PMC [Natoma]
           +-01.0  Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
           +-01.1  Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
           +-01.3  Intel Corporation 82371AB/EB/MB PIIX4 ACPI
           +-02.0-[01]--+-01.0  Red Hat, Inc Virtio block device
           |            +-02.0  Red Hat, Inc Virtio network device
           |            \-03.0  Device 1234:1111
           \-03.0-[02]--

Actual results:
RNG device didn't deleted, even if executed "device_del rng0"many times in hmp
Guest didn't reboot after executed "device_del rng0" many times

Expected results:
RNG device didn't deleted and guest can be reboot successfully

Additional info:

Comment 2 Amit Shah 2016-08-23 20:45:54 UTC
This could be because the guest is using the rng device.

RNG device hot unplug is not a case that's likely to be widespread in use, so I"ll just close this.  This could be more serious if another device, like virtio-net, would be affected.