Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1045243

Summary: qemu-kvm hang after hot-unplug a vf from guest
Product: Red Hat Enterprise Linux 7 Reporter: Jun Li <juli>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, alex.williamson, chayang, juzhang, michen, sluo, virt-maint, xfu
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: 2013-12-20 02:33:07 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 Jun Li 2013-12-20 01:37:38 UTC
Description of problem:
qemu-kvm hang after hot-unplug a vf from win2012r2. 
Note that:
Before hot-unplug this vf from guest, do the following operation: 
# echo 0 > /sys/bus/pci/devices/0000\:05\:00.0/sriov_numvfs

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-1.5.3-21.el7.x86_64
3.10.0-61.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.bring up vfs and unbind them from host, then assign to guest.
# cat init.sh 
#! /bin/sh

./insmod.sh
./reset_num_vfs.sh
./unbind_vf_from_host.sh
---
# cat insmod.sh 
#! /bin/sh

modprobe vfio
modprobe vfio-pci
lsmod |grep vfio

echo 1 > /sys/module/vfio_iommu_type1/parameters/allow_unsafe_interrupts
----
# cat reset_num_vfs.sh 
#! /bin/sh

#modprobe -r ixgbe; modprobe ixgbe max_vfs=1000

# Get max NO. of VFs driver supported:
cat /sys/bus/pci/devices/0000\:05\:00.0/sriov_totalvfs

echo 0 > /sys/bus/pci/devices/0000\:05\:00.0/sriov_numvfs
echo 16 > /sys/bus/pci/devices/0000\:05\:00.0/sriov_numvfs
echo 0 > /sys/bus/pci/devices/0000\:05\:00.1/sriov_numvfs
echo 16 > /sys/bus/pci/devices/0000\:05\:00.1/sriov_numvfs
---
# cat unbind_vf_from_host.sh 
#! /bin/sh

lspci -n -s 0000:05:00.0 | awk '{ print $3 }'

#echo 19a2 0710 > /sys/bus/pci/drivers/vfio-pci/new_id 


echo 0000:05:10.0 > /sys/bus/pci/devices/0000\:05\:10.0/driver/unbind
echo 0000:05:10.1 > /sys/bus/pci/devices/0000\:05\:10.1/driver/unbind
echo 0000:05:10.2 > /sys/bus/pci/devices/0000\:05\:10.2/driver/unbind
echo 0000:05:10.3 > /sys/bus/pci/devices/0000\:05\:10.3/driver/unbind
echo 0000:05:10.4 > /sys/bus/pci/devices/0000\:05\:10.4/driver/unbind
echo 0000:05:10.5 > /sys/bus/pci/devices/0000\:05\:10.5/driver/unbind
echo 0000:05:10.6 > /sys/bus/pci/devices/0000\:05\:10.6/driver/unbind
echo 0000:05:10.7 > /sys/bus/pci/devices/0000\:05\:10.7/driver/unbind



echo 0000:05:11.0 > /sys/bus/pci/devices/0000\:05\:11.0/driver/unbind
echo 0000:05:11.1 > /sys/bus/pci/devices/0000\:05\:11.1/driver/unbind
echo 0000:05:11.2 > /sys/bus/pci/devices/0000\:05\:11.2/driver/unbind
echo 0000:05:11.3 > /sys/bus/pci/devices/0000\:05\:11.3/driver/unbind
echo 0000:05:11.4 > /sys/bus/pci/devices/0000\:05\:11.4/driver/unbind
echo 0000:05:11.5 > /sys/bus/pci/devices/0000\:05\:11.5/driver/unbind
echo 0000:05:11.6 > /sys/bus/pci/devices/0000\:05\:11.6/driver/unbind
echo 0000:05:11.7 > /sys/bus/pci/devices/0000\:05\:11.7/driver/unbind


echo 8086 10ed > /sys/bus/pci/drivers/vfio-pci/new_id 
---
2.Boot guest with following cmd.
<cli>:
# /usr/libexec/qemu-kvm -S -M pc-i440fx-rhel7.0.0 -cpu SandyBridge,hv_spinlocks=0x1fff,hv_relaxed,hv_vapic -enable-kvm -m 2G -smp 2,sockets=2,cores=1,threads=1 -name juli -uuid 355a2475-4e03-4cdd-bf7b-5d6a59edaa68 -rtc base=localtime,clock=host,driftfix=slew -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 -drive file=/home/juli/win2012r2.raw,if=none,id=drive-scsi0-0-0,media=disk,cache=none,format=raw,werror=stop,rerror=stop,aio=native  -device scsi-hd,drive=drive-scsi0-0-0,bus=scsi0.0,scsi-id=0,lun=0,id=juli,bootindex=0 -drive file=/home/juli/ISO/en_windows_server_2012_r2_x64_dvd_2707946.iso,if=none,media=cdrom,format=raw,aio=native,id=drive-ide1-0-0 -device ide-drive,drive=drive-ide1-0-0,id=ide1-0-0,bus=ide.0,unit=0,bootindex=4 -drive file=/home/juli/virtio-win-prewhql-0.1-74.iso,if=none,media=cdrom,format=raw,aio=native,id=drive-ide1-0-1 -device ide-drive,drive=drive-ide1-0-1,id=ide1-0-1,bus=ide.0,unit=1,bootindex=6 -device virtio-balloon-pci,id=ballooning -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -k en-us -boot menu=on,reboot-timeout=-1,strict=on -qmp tcp:0:4499,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :8 -spice port=5961,disable-ticketing  -vga qxl -global qxl-vga.revision=3 -monitor stdio -monitor tcp:0:7766,server,nowait -monitor unix:/tmp/monitor1,server,nowait -netdev tap,id=tap1,vhost=on,queues=4,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap-juli -device virtio-net-pci,netdev=tap1,id=nic1,mq=on,vectors=17,mac=1a:59:0a:4b:aa:94 -device vfio-pci,host=05:10.0,id=hostnet_VF
3.disable IOV via the following command.
# echo 0 > /sys/bus/pci/devices/0000\:05\:00.0/sriov_numvfs
4.hot-unplug vf from guest.
$ telnet 10.66.104.53 4499
{"execute":"qmp_capabilities"}
{"execute":"device_del","arguments":{"id":"hostnet_VF"}}

Actual results:
hot-unplug vf has returned via qmp, such as:
{"execute":"device_del","arguments":{"id":"hostnet_VF"}}
{"return": {}}
Note that: after this, qemu-kvm hang.

Expected results:
qemu-kvm works well. Or forbid hot-unplug vf when guest is using it.

Additional info:

Comment 2 Alex Williamson 2013-12-20 02:33:07 UTC

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