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.
Cause:
On device removal, the device assignment code was only removing resources that had been mapped into the guest address space.
Consequence:
The qemu process may leak open file handles if an assigned device is removed before the guest maps the device resources. If this is repeated, the qemu process may eventually reach it's limit of open file handles.
Fix:
Close all file handles for assigned devices when the device is removed.
Result:
Qemu no longer leaks file handles, regardless of how quickly devices are add and removed from the VM.
Created attachment 480692[details]
device message generated by hot plug/unplug
Description of problem:
when doing hot plug/unplug two vfs about 300 times, qemu reports " get_real_device: /sys/bus/pci/devices/0000:04:10.3/resource: Too many open files"
Version-Release number of selected component (if applicable):
# rpm -qa|grep qemu
gpxe-roms-qemu-0.9.7-6.4.el6.noarch
qemu-kvm-0.12.1.2-2.147.el6.x86_64
qemu-img-0.12.1.2-2.147.el6.x86_64
# uname -r
2.6.32-117.el6.x86_64
# lspci|grep 82576
04:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
04:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
How reproducible:
2/2
Steps to Reproduce:
1.boot a guest
# /usr/libexec/qemu-kvm -M rhel6.1.0 -enable-kvm -m 4096 -smp 4 -cpu qemu64,+sse2,+x2apic -name win2008r2 -uuid b044ca52-c418-461e-bf1e-4075b3e613e4 -rtc base=localtime -boot c -drive file=/root/images/windows2008r2-copy-2.qcow2,if=none,id=drive-ide2-0-0,media=disk,format=qcow2,cache=none -device ide-drive,drive=drive-ide2-0-0,id=ide2-0-0 -netdev tap,id=hostnet2 -device e1000,netdev=hostnet2,id=net2,mac=52:54:87:91:87:93 -usb -device usb-tablet -vnc :2 -monitor stdio -balloon none -qmp tcp:0:4445,server,nowait
2.execute a python script to issue hot plug/unplug vf
for i in range(num):
t = i + 1
print("Try %s times" % t)
cmd = "device_add driver=pci-assign host=04:10.1 id=vf1"
qmp_socket.send(cmd)
time.sleep(3)
cmd = "device_add driver=pci-assign host=04:10.3 id=vf3"
qmp_socket.send(cmd)
time.sleep(3)
cmd = "device_del id=vf1"
qmp_socket.send(cmd)
time.sleep(3)
cmd = "device_del id=vf3"
qmp_socket.send(cmd)
time.sleep(3)
3.
Actual results:
300 times around, qemu failed to hot plug 2nd vf and monitor starts reporting "get_real_device: /sys/bus/pci/devices/0000:04:10.3/resource: Too many open files" when hotplug the second vf every time. At this time, if hot unplug the first vf, then hot plug the second one, qemu won't report such info, and then hot plug the first vf, qemu reports "get_real_device: /sys/bus/pci/devices/0000:04:10.1/resource: Too many open files
pci-assign: Error: Couldn't get real device (vf1)!
Device 'pci-assign' could not be initialized"
Expected results:
qemu could hot plug 2nd vf successfully.
Additional info:
When this occurs, can you please find the qemu process id (note there may be more than one), and add the listing (ls -l) of /proc/<pid>/fd to the bz. You should use the pid that has entries for anon_inode:kvm-vcpu in the same directory. In my testing, all device assignment related file handles are successfully closed when the device is removed.
(In reply to comment #4)
> Please test to see if this brew build fixes the problem, I believe I found the
> error you're hitting:
>
> https://brewweb.devel.redhat.com/taskinfo?taskID=3143074
Alex,
I test for 3 times, I think this brew build you offer has fixed the error.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Cause:
On device removal, the device assignment code was only removing resources that had been mapped into the guest address space.
Consequence:
The qemu process may leak open file handles if an assigned device is removed before the guest maps the device resources. If this is repeated, the qemu process may eventually reach it's limit of open file handles.
Fix:
Close all file handles for assigned devices when the device is removed.
Result:
Qemu no longer leaks file handles, regardless of how quickly devices are add and removed from the VM.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHSA-2011-0534.html
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHSA-2011-0534.html
Created attachment 480692 [details] device message generated by hot plug/unplug Description of problem: when doing hot plug/unplug two vfs about 300 times, qemu reports " get_real_device: /sys/bus/pci/devices/0000:04:10.3/resource: Too many open files" Version-Release number of selected component (if applicable): # rpm -qa|grep qemu gpxe-roms-qemu-0.9.7-6.4.el6.noarch qemu-kvm-0.12.1.2-2.147.el6.x86_64 qemu-img-0.12.1.2-2.147.el6.x86_64 # uname -r 2.6.32-117.el6.x86_64 # lspci|grep 82576 04:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01) 04:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01) How reproducible: 2/2 Steps to Reproduce: 1.boot a guest # /usr/libexec/qemu-kvm -M rhel6.1.0 -enable-kvm -m 4096 -smp 4 -cpu qemu64,+sse2,+x2apic -name win2008r2 -uuid b044ca52-c418-461e-bf1e-4075b3e613e4 -rtc base=localtime -boot c -drive file=/root/images/windows2008r2-copy-2.qcow2,if=none,id=drive-ide2-0-0,media=disk,format=qcow2,cache=none -device ide-drive,drive=drive-ide2-0-0,id=ide2-0-0 -netdev tap,id=hostnet2 -device e1000,netdev=hostnet2,id=net2,mac=52:54:87:91:87:93 -usb -device usb-tablet -vnc :2 -monitor stdio -balloon none -qmp tcp:0:4445,server,nowait 2.execute a python script to issue hot plug/unplug vf for i in range(num): t = i + 1 print("Try %s times" % t) cmd = "device_add driver=pci-assign host=04:10.1 id=vf1" qmp_socket.send(cmd) time.sleep(3) cmd = "device_add driver=pci-assign host=04:10.3 id=vf3" qmp_socket.send(cmd) time.sleep(3) cmd = "device_del id=vf1" qmp_socket.send(cmd) time.sleep(3) cmd = "device_del id=vf3" qmp_socket.send(cmd) time.sleep(3) 3. Actual results: 300 times around, qemu failed to hot plug 2nd vf and monitor starts reporting "get_real_device: /sys/bus/pci/devices/0000:04:10.3/resource: Too many open files" when hotplug the second vf every time. At this time, if hot unplug the first vf, then hot plug the second one, qemu won't report such info, and then hot plug the first vf, qemu reports "get_real_device: /sys/bus/pci/devices/0000:04:10.1/resource: Too many open files pci-assign: Error: Couldn't get real device (vf1)! Device 'pci-assign' could not be initialized" Expected results: qemu could hot plug 2nd vf successfully. Additional info: