Bug 1304964

Summary: No prompt message when hot-unplugged switch that there have devices connected
Product: Red Hat Enterprise Linux 7 Reporter: jingzhao <jinzhao>
Component: qemu-kvm-rhevAssignee: Marcel Apfelbaum <marcel>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: chayang, jinzhao, juzhang, knoel, mst, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-02 17:13:31 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:
Attachments:
Description Flags
Dmesg of hot-unplug switch none

Description jingzhao 2016-02-05 05:56:48 UTC
Description of problem:
There have no warning message when hot-unplugged switch that there have devices connected 

Version-Release number of selected component (if applicable):
kernel:3.10.0-327.10.1.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7_2.7.x86_64

How reproducible:
3/3

Steps to Reproduce:
1. Boot guest with following cli:
/usr/libexec/qemu-kvm \
-M q35 \
-cpu SandyBridge \
-nodefaults -rtc base=utc \
-m 4G \
-smp 2,sockets=2,cores=1,threads=1 \
-enable-kvm \
-name rhel6 \
-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 \
-monitor stdio \
-serial unix:/tmp/serial0,server,nowait \
-boot menu=on \
-bios /usr/share/seabios/bios.bin \
-vga std \
-vnc :0 \
-drive file=/home/rhel.img,if=none,id=drive-virtio-disk0,format=raw,cache=none,werror=stop,rerror=stop,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pcie.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=0 \
-device ioh3420,bus=pcie.0,id=root.0,slot=1 \
-device ioh3420,bus=pcie.0,id=root.1,slot=2 \
-device x3130-upstream,bus=root.0,id=upstream1 \
-device xio3130-downstream,bus=upstream1,id=downstream1,chassis=1 \
-device x3130-upstream,bus=downstream1,id=upstream2 \
-device xio3130-downstream,bus=upstream2,id=downstream2,chassis=2 \
-device usb-ehci,bus=downstream2,id=ehci \
-drive if=none,file=/home/storage.qcow2,id=disk \
-device usb-storage,drive=disk,bus=ehci.0 \
-netdev tap,id=hostnet1,vhost=on \
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=54:52:00:B6:40:22,bus=root.1 \
-device i82801b11-bridge,bus=root.0,id=bridge1 \
-device pci-bridge,id=bridge2,chassis_nr=1,bus=bridge1 \
-device virtio-scsi-pci,id=scsi,bus=downstream2,addr=0x8 \
-drive file=/home/scsi-disk.qcow2,if=none,media=disk,format=qcow2,id=virtio-scsi \
-device scsi-disk,drive=virtio-scsi,id=virtio-scsi1,bus=scsi.0 \

2.check the devices with hmp:
(qemu) info usb
  Device 0.2, Port 1, Speed 480 Mb/s, Product QEMU USB MSD
(qemu) info block
drive-virtio-disk0: /home/rhel.img (raw)
    Cache mode:       writeback, direct

disk: /home/storage.qcow2 (qcow2)
    Cache mode:       writeback

virtio-scsi: /home/scsi-disk.qcow2 (qcow2)

and check it in guest:

[root@localhost ~]# lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
00:01.0 VGA compatible controller: Device 1234:1111 (rev 02)
00:02.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:03.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 0 (rev 02)
00:04.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 0 (rev 02)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
01:00.0 PCI bridge: Texas Instruments XIO3130 PCI Express Switch (Upstream) (rev 02)
02:00.0 PCI bridge: Texas Instruments XIO3130 PCI Express Switch (Downstream) (rev 01)
03:00.0 PCI bridge: Texas Instruments XIO3130 PCI Express Switch (Upstream) (rev 02)
04:00.0 PCI bridge: Texas Instruments XIO3130 PCI Express Switch (Downstream) (rev 01)
05:00.0 USB controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 10)
06:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
08:00.0 Ethernet controller: Red Hat, Inc Virtio network device
[root@localhost ~]# lspci -t -vvv
-[0000:00]-+-00.0  Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
           +-01.0  Device 1234:1111
           +-02.0  Red Hat, Inc Virtio block device
           +-03.0-[01-07]--+-[0000:06]---00.0-[07]--
           |               \-[0000:01]---00.0-[02-05]----00.0-[03-05]----00.0-[04-05]----00.0-[05]----00.0  Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller
           +-04.0-[08]----00.0  Red Hat, Inc Virtio network device
           +-1f.0  Intel Corporation 82801IB (ICH9) LPC Interface Controller
           +-1f.2  Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode]
           \-1f.3  Intel Corporation 82801I (ICH9 Family) SMBus Controller



3. deleted the switch 
(qemu) device_del upstream2

4. check the devices after deleted switch in hmp:
(qemu) info usb
USB support not enabled
(qemu) info block
drive-virtio-disk0: /home/rhel.img (raw)
    Cache mode:       writeback, direct

and checked it in guest:

[root@localhost ~]# lspci -t -vvv 
-[0000:00]-+-00.0  Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
           +-01.0  Device 1234:1111
           +-02.0  Red Hat, Inc Virtio block device
           +-03.0-[01-07]--+-[0000:06]---00.0-[07]--
           |               \-[0000:01]---00.0-[02-05]----00.0-[03-05]--
           +-04.0-[08]----00.0  Red Hat, Inc Virtio network device
           +-1f.0  Intel Corporation 82801IB (ICH9) LPC Interface Controller
           +-1f.2  Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode]
           \-1f.3  Intel Corporation 82801I (ICH9 Family) SMBus Controller
[root@localhost ~]# lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
00:01.0 VGA compatible controller: Device 1234:1111 (rev 02)
00:02.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:03.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 0 (rev 02)
00:04.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 0 (rev 02)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
01:00.0 PCI bridge: Texas Instruments XIO3130 PCI Express Switch (Upstream) (rev 02)
02:00.0 PCI bridge: Texas Instruments XIO3130 PCI Express Switch (Downstream) (rev 01)
06:00.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge
08:00.0 Ethernet controller: Red Hat, Inc Virtio network device



Actual results:
The switch deleted correctly


Expected results:
There have some warnings when deleted the switch


Additional info:

Comment 2 Marcel Apfelbaum 2016-03-01 08:34:47 UTC
Hi,
I rechecked the PCI Express spec and this is the desired behavior:
When hot-unplugging a switch all devices behind it should be unplugged.
Can you please provide guest dmesg? If it is clean (no error messages)
we can close the BZ "as designed"


Thanks,
Marcel

Comment 3 jingzhao 2016-03-02 01:20:05 UTC
(In reply to Marcel Apfelbaum from comment #2)
> Hi,
> I rechecked the PCI Express spec and this is the desired behavior:
> When hot-unplugging a switch all devices behind it should be unplugged.
> Can you please provide guest dmesg? If it is clean (no error messages)
> we can close the BZ "as designed"
> 
> 
> Thanks,
> Marcel

Hi Marcel

 Checked the dmesg of guest(rhel7,kernel-3.10.0-327.el7.x86_64) and there have no error messages. Attachment is the dmesg of hot-unplug the switch

Thanks
Jing

Comment 4 jingzhao 2016-03-02 01:22:31 UTC
Created attachment 1132095 [details]
Dmesg of hot-unplug switch

Comment 5 Marcel Apfelbaum 2016-03-02 17:13:31 UTC
It works as designed and dmesg is clean, all devices behind the switch are disconnected before the switch is going offline.