Bug 1529494

Summary: Hot-unplug devices that under pxb bus failed without any prompt
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Yanan Fu <yfu>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
qemu-kvm sub component: Devices QA Contact: yduan
Status: CLOSED DEFERRED Docs Contact:
Severity: medium    
Priority: medium CC: ailan, chayang, jinzhao, juzhang, knoel, laine, rbalakri, virt-maint, xfu, yanyang, yduan
Version: 8.0Keywords: FutureFeature, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-24 21:01:01 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1408812    

Description Yanan Fu 2017-12-28 11:34:37 UTC
Description of problem:
Boot vm with a pxb device, and add one virtio nic under the pxb bus.
After vm boot up, hot un-plug the device, qmp and hmp all return without error.
No error in dmesg too.  But the device still exist in both qemu monitor(info pci) and inside guest (lspci)

Version-Release number of selected component (if applicable):
qemu: qemu-kvm-rhev-2-10-0-13.el7
kernel: kernel-3.10.0-824.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Boot vm with pxb device, and add one virtio nic under pxb bus.

-object memory-backend-ram,host-nodes=0,policy=bind,id=mem-0,size=2048M,prealloc=yes -numa node,memdev=mem-0 \
-object memory-backend-ram,host-nodes=1,policy=bind,id=mem-1,size=2048M,prealloc=yes -numa node,memdev=mem-1 \
-device pxb,id=pxb,bus_nr=4,numa_node=1 \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:0b:4c,bus=pxb,addr=0x2 \

(qemu) info pci 
  Bus  4, device   0, function 0:
    PCI bridge: PCI device 1b36:0001
      BUS 4.
      secondary bus 5.
      subordinate bus 5.
      IO range [0xc000, 0xcfff]
      memory range [0xfc000000, 0xfc7fffff]
      prefetchable memory range [0xfe800000, 0xfe9fffff]
      id "pxb"
  Bus  5, device   2, function 0:
    Ethernet controller: PCI device 1af4:1000
      IRQ 10.
      BAR0: I/O at 0xc000 [0xc01f].
      BAR1: 32 bit memory at 0xfc464000 [0xfc464fff].
      BAR4: 64 bit prefetchable memory at 0xfe800000 [0xfe803fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe].
      id "net0"

2.After guest boot up, hot unplug the devices under pxb bus.
(qemu) device_del net0 
(qemu) netdev_del hostnet0 
(qemu) info network 
net0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:60:0b:4c
 \ hostnet0: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown

(qemu) info pci 
  Bus  4, device   0, function 0:
    PCI bridge: PCI device 1b36:0001
      BUS 4.
      secondary bus 5.
      subordinate bus 5.
      IO range [0xc000, 0xcfff]
      memory range [0xfc000000, 0xfc7fffff]
      prefetchable memory range [0xfe800000, 0xfe9fffff]
      id "pxb"
  Bus  5, device   2, function 0:
    Ethernet controller: PCI device 1af4:1000
      IRQ 10.
      BAR0: I/O at 0xc000 [0xc01f].
      BAR1: 32 bit memory at 0xfc464000 [0xfc464fff].
      BAR4: 64 bit prefetchable memory at 0xfe800000 [0xfe803fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe].
      id "net0"

3. IN VM, after "device_del net0", the nic still can ping through.
after "netdev_del hostnet0", the nic can not be reached.

Actual results:
device under pxb bus can not be hot unpluged, and no prompt.

Expected results:
I am not sure it is supported or not. but, if it is not supported, qemu should give some message to explain it.
such as, un-plug pxb device.
(qemu) device_del pxb
Device 'pxb' does not support hotplugging


Additional info:
1. This is not a regression, RHEL7.4 have the same problem.
2. I have tried add one bridge under pxb bus, and then add virtio nic under the bridge, sane result, and the bridge can not be un-pluged too, no warning.

-object memory-backend-ram,host-nodes=0,policy=bind,id=mem-0,size=2048M,prealloc=yes -numa node,memdev=mem-0 \
-object memory-backend-ram,host-nodes=1,policy=bind,id=mem-1,size=2048M,prealloc=yes -numa node,memdev=mem-1 \
-device pxb,id=pxb,bus_nr=4,numa_node=1 \
-device pci-bridge,bus=pxb,id=bridge0,chassis_nr=1 \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:0b:4c,bus=bridge0,addr=0x1 \
-device vfio-pci,host=44:00.0,id=pf,bus=pxb,addr=0x3 \

3. No only virtio-net pci device has this problem, i have tried pass through nic, it has the same problem.

Comment 3 Marcel Apfelbaum 2018-04-26 13:13:54 UTC
*** Bug 1361059 has been marked as a duplicate of this bug. ***

Comment 9 Ademar Reis 2020-02-05 22:46:11 UTC
QEMU has been recently split into sub-components and as a one-time operation to avoid breakage of tools, we are setting the QEMU sub-component of this BZ to "General". Please review and change the sub-component if necessary the next time you review this BZ. Thanks