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 1117672

Summary: qemu-kvm quit on "create_userspace_phys_mem: Invalid argument" when hot plugging the 8th VF
Product: Red Hat Enterprise Linux 6 Reporter: Chao Yang <chayang>
Component: qemu-kvmAssignee: Alex Williamson <alex.williamson>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: alex.williamson, bdas, bsarathy, chayang, juzhang, michen, mkenneth, qzhang, rbalakri, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-15 19:34:10 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:
Attachments:
Description Flags
dump of lspci -vvv none

Description Chao Yang 2014-07-09 08:01:28 UTC
Description of problem:
Bring up to 10 VFs on each QLogic Corp. ISP8324 port. Then hot plug as many as 8 VFs to guest, qemu-kvm quit exactly on the 8th attempt.

Tried same scenario through virsh, same failure on exact same number of attempts.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.429.el6.x86_64
2.6.32-489.el6.x86_64

How reproducible:
2/2

Steps to Reproduce:
1. 
# ls /sys/bus/pci/drivers/pci-stub/
0000:42:02.0  0000:42:02.2  0000:42:02.4  0000:42:0a.1  0000:42:0a.3  bind    remove_id  unbind
0000:42:02.1  0000:42:02.3  0000:42:0a.0  0000:42:0a.2  0000:42:0a.4  new_id  uevent

2. 
QMP way:
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:02.0","id":"hostnet_VF-0"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:02.1","id":"hostnet_VF-1"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:02.2","id":"hostnet_VF-2"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:02.3","id":"hostnet_VF-3"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:02.4","id":"hostnet_VF-4"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:0a.0","id":"hostnet_VF-5"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:0a.1","id":"hostnet_VF-6"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"pci-assign","host":"0000:42:0a.2","id":"hostnet_VF-7"}}
{"return": {}}

(qemu) create_userspace_phys_mem: Invalid argument
assigned_dev_iomem_map: Error: create new mapping failed

3.
virsh way:

# virsh attach-device sriov VF-1.xml 
Device attached successfully
# virsh qemu-monitor-command sriov --hmp "info pci" | grep "1077:8430"
    Ethernet controller: PCI device 1077:8430

# virsh attach-device sriov VF-2.xml 
Device attached successfully
# virsh qemu-monitor-command sriov --hmp "info pci" | grep "1077:8430"
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430

...

# virsh attach-device sriov VF-7.xml 
Device attached successfully

# virsh qemu-monitor-command sriov --hmp "info pci" | grep "1077:8430"
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430
    Ethernet controller: PCI device 1077:8430

# virsh attach-device sriov VF-8.xml 
Device attached successfully

# virsh qemu-monitor-command sriov --hmp "info pci" | grep "1077:8430"

^^^^^ Above command didn't return

Check libvirt log, /var/log/libvirt/qemu/sriov.log:

Domain id=2 is tainted: custom-monitor
create_userspace_phys_mem: Invalid argument
assigned_dev_iomem_map: Error: create new mapping failed
red_channel_client_disconnect: rcc=0x7fab741bf010 (channel=0x7faa5821f350 type=2 id=0)
red_channel_client_disconnect: rcc=0x7faa58243e70 (channel=0x7faa5821f920 type=4 id=0)
2014-07-09 06:53:25.692+0000: shutting down


Actual results:


Expected results:


Additional info:

Comment 2 Alex Williamson 2014-07-14 22:10:00 UTC
lspci -vvv of one of the VFs please.  We have a very limited number of memory slots available for devices on RHEL6 and the limit of 8 devices is only a heuristic.  It's possible this device runs out of slots on the 8th device.

Comment 3 Chao Yang 2014-07-15 05:32:51 UTC
Created attachment 918060 [details]
dump of lspci -vvv

Comment 6 Alex Williamson 2015-01-15 19:34:10 UTC
The devices each have 3 BARs and neither the MSI-X configuration nor ROM (none) should impose additional memory slots.  3 memory slots per device is the limit of the heuristic we use to come up with 8 devices, leaving only 8 further memory slots for the reset of the VM.  We're not going to increase the memory slots for such a corner case in RHEL6, nor are we going to implement memory slot avoidance slow path.  RHEL7 supports more devices already.