Bug 1459017

Summary: After Hotplug virtio-serial-pci and ports during early stage booting of guest port wasn't shown in guest
Product: Red Hat Enterprise Linux 7 Reporter: Min Deng <mdeng>
Component: qemu-kvm-rhevAssignee: David Gibson <dgibson>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: knoel, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-07 03:23:46 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:
Embargoed:

Description Min Deng 2017-06-06 07:01:01 UTC
Description of problem:
After Hotplug virtio-serial-pci and ports during early stage booting of guest port wasn't shown in guest


Version-Release number of selected component (if applicable):
kernel-3.10.0-675.el7.ppc64le
qemu-kvm-rhev-2.9.0-7.el7.ppc64le
SLOF-20170303-4.git66d250e.el7.noarch

How reproducible:
2/5

Steps to Reproduce:

1.prerequisite
  boot up a guest with a chardev
  eg,/usr/libexec/qemu-kvm -name avocado-vt-vm1 -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1,server,nowait -mon chardev=qmp_id_qmpmonitor1,mode=control -sandbox on -machine pseries-rhel7.4.0 -nodefaults -vga std -chardev socket,id=serial_id_serial0,path=/tmp/ttt,server,nowait -device spapr-vty,reg=0x30000000,chardev=serial_id_serial0 -device nec-usb-xhci,id=usb1,bus=pci.0,addr=0x3 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=rhel74-ppc64-virtio-scsi.qcow2 -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=1,bus=pci.0,addr=0x4 -device spapr-vlan,mac=9a:93:94:95:96:97,id=idpWdRJ9,netdev=idkTBKmY -netdev tap,id=idkTBKmY,vhost=on,script=/etc/qemu-ifup,downscript=/etc/qemu-down,id=hostnet1 -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x6 -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=4 -vnc :1 -rtc base=utc,clock=host -boot order=cdn,once=d,menu=off,strict=off -enable-kvm -monitor stdio -monitor unix:/tmp/monitor3,server,nowait -qmp tcp:0:4444,server,nowait -m 8G,slots=32,maxmem=80G -numa node -chardev socket,id=channel1,path=/tmp/helloworld,server,nowait

2.During the early stage of booting 
(qemu) device_add virtio-serial-pci,id=virtio-serial0,max_ports=16
(qemu) device_add virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port0

Actual results:
After login guest 
ls /dev/vp* to check the port,but it didn't exist.

Expected results:
The port was there 

Additional info:
Info qtree log after hotplug virtio-serail-pci and port
(qemu) info qtree
bus: main-system-bus
  type System
  dev: spapr-pci-host-bridge, id ""
    index = 0 (0x0)
    buid = 576460752840294400 (0x800000020000000)
    liobn = 2147483648 (0x80000000)
    liobn64 = 2147483649 (0x80000001)
    mem_win_addr = 35186519572480 (0x200080000000)
    mem_win_size = 2147483648 (0x80000000)
    mem64_win_addr = 36283883716608 (0x210000000000)
    mem64_win_size = 1099511627776 (0x10000000000)
    mem64_win_pciaddr = 36283883716608 (0x210000000000)
    io_win_addr = 35184372088832 (0x200000000000)
    io_win_size = 65536 (0x10000)
    dynamic-reconfiguration = true
    dma_win_addr = 0 (0x0)
    dma_win_size = 1073741824 (0x40000000)
    dma64_win_addr = 576460752303423488 (0x800000000000000)
    ddw = true
    pgsz = 69632 (0x11000)
    numa_node = 4294967295 (0xffffffff)
    pre-2.8-migration = false
    pcie-extended-configuration-space = true
    bus: pci.0
      type PCI
      dev: virtio-serial-pci, id "virtio-serial0"
        ioeventfd = true
        vectors = 2 (0x2)
        class = 1920 (0x780)
        virtio-pci-bus-master-bug-migration = false
        disable-legacy = "off"
        disable-modern = false
        migrate-extra = true
        modern-pio-notify = false
        x-disable-pcie = false
        page-per-vq = false
        x-ignore-backend-features = false
        ats = false
        x-pcie-deverr-init = true
        x-pcie-lnkctl-init = true
        x-pcie-pm-init = true
        addr = 01.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        class Class 0780, addr 00:01.0, pci id 1af4:1003 (sub 1af4:0003)
        bar 0: i/o at 0xffffffffffffffff [0x3e]
        bar 1: mem at 0xffffffffffffffff [0xffe]
        bar 4: mem at 0xffffffffffffffff [0x3ffe]
        bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 16 (0x10)
            emergency-write = true
            indirect_desc = true
            event_idx = true
            notify_on_empty = true
            any_layout = true
            iommu_platform = false
            __com.redhat_rhel6_ctrl_guest_workaround = false
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "port0"
                chardev = "channel1"
                nr = 1 (0x1)
                name = "com.redhat.rhevm.vdsm"
                port 1, guest off, host off, throttle off
      dev: virtio-scsi-pci, id "virtio_scsi_pci0"
        ioeventfd = true
        vectors = 4 (0x4)
        virtio-pci-bus-master-bug-migration = false
        disable-legacy = "off"
        disable-modern = false
        migrate-extra = true
        modern-pio-notify = false
        x-disable-pcie = false
        page-per-vq = false
        x-ignore-backend-features = false
        ats = false
        x-pcie-deverr-init = true
        x-pcie-lnkctl-init = true
        x-pcie-pm-init = true
        addr = 06.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        class SCSI controller, addr 00:06.0, pci id 1af4:1004 (sub 1af4:0008)
        bar 0: i/o at 0x80 [0xbf]
        bar 1: mem at 0xc0025000 [0xc0025fff]
        bar 4: mem at 0x210000004000 [0x210000007fff]
        bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-scsi-device, id ""
            num_queues = 1 (0x1)
            max_sectors = 65535 (0xffff)
            cmd_per_lun = 128 (0x80)
            hotplug = true
            param_change = true
            indirect_desc = true
            event_idx = true
            notify_on_empty = true
            any_layout = true
            iommu_platform = false
            __com.redhat_rhel6_ctrl_guest_workaround = false
            bus: virtio_scsi_pci0.0
              type SCSI
      dev: virtio-blk-pci, id "image1"
        class = 0 (0x0)
        ioeventfd = true
        vectors = 2 (0x2)
        virtio-pci-bus-master-bug-migration = false
        disable-legacy = "off"
        disable-modern = false
        migrate-extra = true
        modern-pio-notify = false
        x-disable-pcie = false
        page-per-vq = false
        x-ignore-backend-features = false
        ats = false
        x-pcie-deverr-init = true
        x-pcie-lnkctl-init = true
        x-pcie-pm-init = true
        addr = 04.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        class SCSI controller, addr 00:04.0, pci id 1af4:1001 (sub 1af4:0002)
        bar 0: i/o at 0x40 [0x7f]
        bar 1: mem at 0xc0024000 [0xc0024fff]
        bar 4: mem at 0x210000000000 [0x210000003fff]
        bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-blk-device, id ""
            drive = "drive_image1"
            logical_block_size = 512 (0x200)
            physical_block_size = 512 (0x200)
            min_io_size = 0 (0x0)
            opt_io_size = 0 (0x0)
            discard_granularity = 4294967295 (0xffffffff)
            write-cache = "auto"
            share-rw = false
            rerror = "auto"
            werror = "auto"
            cyls = 16383 (0x3fff)
            heads = 16 (0x10)
            secs = 63 (0x3f)
            serial = ""
            config-wce = true
            scsi = false
            request-merging = true
            num-queues = 1 (0x1)
            indirect_desc = true
            event_idx = true
            notify_on_empty = true
            any_layout = true
            iommu_platform = false
            __com.redhat_rhel6_ctrl_guest_workaround = false
      dev: nec-usb-xhci, id "usb1"
        msi = "auto"
        msix = "auto"
        superspeed-ports-first = true
        force-pcie-endcap = false
        intrs = 16 (0x10)
        slots = 64 (0x40)
        streams = true
        p2 = 4 (0x4)
        p3 = 4 (0x4)
        addr = 03.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        class USB controller, addr 00:03.0, pci id 1033:0194 (sub 1af4:1100)
        bar 0: mem at 0xc0020000 [0xc0023fff]
        bus: usb1.0
          type usb-bus
          dev: usb-tablet, id "usb-tablet1"
            usb_version = 2 (0x2)
            display = ""
            head = 0 (0x0)
            port = "4"
            serial = ""
            full-path = true
            msos-desc = true
            addr 0.3, port 4, speed 480, name QEMU USB Tablet, attached
          dev: usb-mouse, id "input1"
            usb_version = 2 (0x2)
            port = ""
            serial = ""
            full-path = true
            msos-desc = true
            addr 0.2, port 2, speed 480, name QEMU USB Mouse, attached
          dev: usb-kbd, id "input0"
            usb_version = 2 (0x2)
            display = ""
            port = ""
            serial = ""
            full-path = true
            msos-desc = true
            addr 0.1, port 1, speed 480, name QEMU USB Keyboard, attached
      dev: VGA, id ""
        vgamem_mb = 16 (0x10)
        mmio = true
        qemu-extended-regs = true
        addr = 00.0
        romfile = "vgabios-stdvga.bin"
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        class VGA controller, addr 00:00.0, pci id 1234:1111 (sub 1af4:1100)
        bar 0: mem at 0x80000000 [0x80ffffff]
        bar 2: mem at 0xc0000000 [0xc0000fff]
        bar 6: mem at 0xffffffffffffffff [0xfffe]
  dev: spapr-vio-bridge, id ""
    bus: spapr-vio
      type spapr-vio-bus
      dev: spapr-vlan, id "idpWdRJ9"
        reg = 1895825409 (0x71000001)
        mac = "9a:93:94:95:96:97"
        vlan = <null>
        netdev = "idkTBKmY"
        use-rx-buffer-pools = true
        irq = 4104 (0x1008)
      dev: spapr-vty, id "vty@30000000"
        reg = 805306368 (0x30000000)
        chardev = "serial_id_serial0"
        irq = 4103 (0x1007)
      dev: spapr-nvram, id "nvram@71000000"
        reg = 1895825408 (0x71000000)
        drive = ""
        irq = 4098 (0x1002)
  dev: spapr-rtc, id ""

Comment 2 Min Deng 2017-06-06 07:02:49 UTC
QE also tried it on x86 platform but never reproduced the issue so marked it as ppc64le.

Comment 3 David Gibson 2017-06-07 00:52:44 UTC
This is a dupe of bug 1448344, only with PCI instead of a CPU device.

Basically there are problems with state management of hotplug which mean that an early plugged device will mean the guest gets information duplicated between the "coldplug" and "hotplug" device discovery mechanisms, leading to this.

I'm actively working on this (amongst other hotplug problems) upstream, so we'll probably have to punt this to 7.5.

Comment 4 David Gibson 2017-06-07 03:23:46 UTC

*** This bug has been marked as a duplicate of bug 1448344 ***