Bug 752672

Summary: With multifunction, hot-unplug one virtual function will cause all the other virtual functions that share with the same slot disappear
Product: Red Hat Enterprise Linux 6 Reporter: FuXiangChun <xfu>
Component: qemu-kvmAssignee: Amos Kong <akong>
Status: CLOSED CANTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: acathrow, ailan, armbru, bsarathy, juzhang, michen, mkenneth, rhod, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-08 18:02:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description FuXiangChun 2011-11-10 05:01:56 UTC
Description of problem:
boot guest with a multiple virtio nics, and every 8 virtio nics depend on a slot via multifunction=on option. after unhotplug one of 8 virtio nics, the dependent slot will be deleted too. 

Version-Release number of selected component (if applicable):
# rpm -qa|grep qemu
qemu-kvm-0.12.1.2-2.209.el6.x86_64
# uname -r
2.6.32-214.el6.x86_64

guest:
win7-64

How reproducible:


Steps to Reproduce:
1./usr/libexec/qemu-kvm -M rhel6.2.0 -monitor stdio -enable-kvm -m 4G -smp 2,sockets=2,cores=1,threads=1 -name rhel6 -uuid 745fe449-aac8-29f1-0c2d-5042a707263b -boot c -drive file=/home/win7_x64.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,cache=none,aio=threads -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -spice disable-ticketing,port=5914 \
-netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,mac=00:12:17:18:49:30,bus=pci.0,id=virtio-net-pci0,multifunction=on,addr=0x03.0 \
-netdev tap,id=hostnet1,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet1,mac=00:12:17:18:49:31,bus=pci.0,id=virtio-net-pci1,multifunction=on,addr=0x03.1 \
-netdev tap,id=hostnet2,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet2,mac=00:12:17:18:49:32,bus=pci.0,id=virtio-net-pci2,multifunction=on,addr=0x03.2 \
-netdev tap,id=hostnet3,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet3,mac=00:12:17:18:49:33,bus=pci.0,id=virtio-net-pci3,multifunction=on,addr=0x03.3 \
-netdev tap,id=hostnet4,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet4,mac=00:12:17:18:49:34,bus=pci.0,id=virtio-net-pci4,multifunction=on,addr=0x03.4 \
-netdev tap,id=hostnet5,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet5,mac=00:12:17:18:49:35,bus=pci.0,id=virtio-net-pci5,multifunction=on,addr=0x03.5 \
-netdev tap,id=hostnet6,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet6,mac=00:12:17:18:49:36,bus=pci.0,id=virtio-net-pci6,multifunction=on,addr=0x03.6 \
-netdev tap,id=hostnet7,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet7,mac=00:12:17:18:49:37,bus=pci.0,id=virtio-net-pci7,multifunction=on,addr=0x03.7 \
-netdev tap,id=hostnet8,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet8,mac=00:12:17:18:40:30,bus=pci.0,id=virtio-net-pci8,multifunction=on,addr=0x04.0 \
-netdev tap,id=hostnet9,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet9,mac=00:12:17:18:41:31,bus=pci.0,id=virtio-net-pci9,multifunction=on,addr=0x04.1 \
-netdev tap,id=hostnet10,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet10,mac=00:12:17:18:42:32,bus=pci.0,id=virtio-net-pci10,multifunction=on,addr=0x04.2 \
-netdev tap,id=hostnet11,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet11,mac=00:12:17:18:43:33,bus=pci.0,id=virtio-net-pci11,multifunction=on,addr=0x04.3 \
-netdev tap,id=hostnet12,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet12,mac=00:12:17:18:44:34,bus=pci.0,id=virtio-net-pci12,multifunction=on,addr=0x04.4 \
-netdev tap,id=hostnet13,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet13,mac=00:12:17:18:45:35,bus=pci.0,id=virtio-net-pci13,multifunction=on,addr=0x04.5 \
-netdev tap,id=hostnet14,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet14,mac=00:12:17:18:46:36,bus=pci.0,id=virtio-net-pci14,multifunction=on,addr=0x04.6 \
-netdev tap,id=hostnet15,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet15,mac=00:12:17:18:47:37,bus=pci.0,id=virtio-net-pci15,multifunction=on,addr=0x04.7 \

2.(qemu)device_del virtio-net-pci14
3.info pci
  
Actual results:
delete virtio-net-pci8...virtio-net-pci15

Expected results:
only delete virtio-net-pci14

Additional info:
if hotplug virtio nic(multifunction=on), qemu work well

Comment 2 juzhang 2011-11-10 05:18:28 UTC
we are not very whether we support hot unplug pci device or not,for now,if we
don't support that,please free to add FEAT

Comment 3 juzhang 2011-11-10 05:20:24 UTC
(In reply to comment #2)
> we are not very whether we support hot unplug pci device or not,for now,if we
> don't support that,please free to add FEAT
Correction
we are not very whether we support hot unplug pci device with enable multifunction  or not,for now,if we don't support that,please free to add FEAT

Comment 4 Markus Armbruster 2011-11-22 12:57:46 UTC
PCI hotplug operates on a slot, not on a function.  You can plug or unplug a physical PCI card (slot), but not logical parts of it (functions).

qemu-kvm doesn't quite emulate that properly.  Hotplug/unplug of multifunction devices doesn't work, only coldplug.  As far as I can tell, libvirt doesn't let you unplug multifunction devices.

RHEL-6 supports multifunction=on *only* with -device pci-assign, not with -virtio-net-pci, precisely because it doesn't play nice with unplug.  See "Virtualization Administration Guide", chapter "qemu-kvm Whitelist", section "Device options".

Comment 5 Ronen Hod 2011-12-08 18:02:12 UTC
Closing, since PCI does not support unplug a single virtual function.
At best the operation should fail, but since libvirt is not using it, it is not worth the effort.