Bug 702574

Summary: device-assignment leaks option ROM memory
Product: Red Hat Enterprise Linux 5 Reporter: Chao Yang <chayang>
Component: kvmAssignee: Alex Williamson <alex.williamson>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7CC: gcosta, juzhang, michen, mkenneth, shuang, 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-07-27 18:01:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 580948    
Attachments:
Description Flags
lspci info and output of ps --format 'vsz' `pidof qemu-kvm` none

Description Chao Yang 2011-05-06 07:44:39 UTC
Created attachment 497300 [details]
lspci info and output of ps --format 'vsz' `pidof qemu-kvm`

Description of problem:
Repeatedly added and removed from a guest, the option ROM memory is leaked.
Will attach 82756 lspci info and output of ps --format 'vsz' `pidof qemu-kvm`

Version-Release number of selected component (if applicable):
kvm-83-232.el5

How reproducible:
100%

Steps to Reproduce:
1. unbind nic
# lspci -n -s 04:00.0
04:00.0 0200: 8086:10c9 (rev 01)

echo "8086 10c9" > /sys/bus/pci/drivers/pci-stub/new_id 
echo 0000:04:00.0 > /sys/bus/pci/devices/0000\:04\:00.0/driver/unbind 
echo 0000:04:00.0 > /sys/bus/pci/drivers/pci-stub/bind 

2. boot a guest by
 /usr/libexec/qemu-kvm -M rhel5.6.0 -no-hpet -rtc-td-hack -startdate now -name rhel5.7 -smp 2 -m 2048 -cpu qemu64,+sse2 -uuid `uuidgen` -boot c -net none -drive file=images/win7-64.qcow2,media=disk,if=virtio,cache=none,boot=on,format=qcow2 -vnc :1 -notify all -balloon none -monitor unix:/tmp/chayang-sock,server,nowait

3. repeatedly add and remove
echo "info pci" | nc -U /tmp/chayang-sock
for i in $(seq 5000)
do
echo 
echo "HOTPLUG/HOTUNPLUG times: $i "
echo 
echo "pci_add pci_addr=auto host host=04:00.0" | nc -U /tmp/chayang-sock
sleep 5
echo "pci_del pci_addr=0:4" | nc -U /tmp/chayang-sock
sleep 5
done
  
Actual results:
qemu-kvm memory leaks.

Expected results:


Additional info:
Over 100 times repeatedly add and remove, qemu complains following, but monitor hints successfully hot add/remove.

HOTPLUG/HOTUNPLUG times: 114 

QEMU 0.9.1 monitor - type 'help' for more information
(qemu) pci_add pci_addr=auto host host=04:00.0
Registered host PCI device 04:00.0 ("04:00.0") as guest device 00:04.0
OK domain 0, bus 0, slot 4, function 0
QEMU 0.9.1 monitor - type 'help' for more information
(qemu) pci_del pci_addr=0:4
(qemu) 

assigned_dev_update_msix_mmio: No such device or address
assigned_dev_update_msix_mmio: No such device or address
assigned_dev_update_msix_mmio: No such device or address
assigned_dev_update_msix_mmio: No such device or address
...