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 1329090 - Provide proper error when setting pcie-switch-upstream-port controller's index >=257
Summary: Provide proper error when setting pcie-switch-upstream-port controller's inde...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-21 07:59 UTC by Yang Yang
Modified: 2017-08-01 23:51 UTC (History)
4 users (show)

Fixed In Version: libvirt-3.2.0-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:09:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Yang Yang 2016-04-21 07:59:18 UTC
Description of problem:
When setting pcie-switch-upstream-port index>=257, libvirt report
long unclear error message like this
# virsh create vm1-q35.xml
error: Failed to create domain from vm1-q35.xml
error: internal error: early end of file from monitor, possible problem: 247,bus=pci.9,addr=0x1c -device pci-bridge,chassis_nr=248,id=pci.248,bus=pci.9,addr=0x1d -device pci-bridge,chassis_nr=249,id=pci.249,bus=pci.9,addr=0x1e -device pci-bridge,chassis_nr=250,id=pci.250,bus=pci.9,addr=0x1f -device pci-bridge,chassis_nr=251,id=pci.251,bus=pci.10,addr=0x1 -device pci-bridge,chassis_nr=252,id=pci.252,bus=pci.10,addr=0x2 -device pci-bridge,chassis_nr=253,id=pci.253,bus=pci.10,addr=0x3 -device pci-bridge,chassis_nr=254,id=pci.254,bus=pci.10,addr=0x4 -device pci-bridge,chassis_nr=255,id=pci.255,bus=pci.10,addr=0x5 -device pci-bridge,chassis_nr=256,id=pci.256,bus=pci.10,addr=0x6 -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 -device vir!
 tio-scsi-pci,id=scsi0,bus=pci.10,addr=0xa -device virtio

Version-Release number of selected component (if applicable):
100%

How reproducible:
libvirt-1.3.3-2.el7.x86_64

Steps to Reproduce:
1. prepare a xml and set pcie-switch-upstream-port controller's index=257
<controller type='pci' index='3' model='pcie-root-port'/>
<controller type='pci' index='257' model='pcie-switch-upstream-port'/>

2. create vm
# virsh create vm1-q35.xml
error: Failed to create domain from vm1-q35.xml
error: internal error: early end of file from monitor, possible problem: 247,bus=pci.9,addr=0x1c -device pci-bridge,chassis_nr=248,id=pci.248,bus=pci.9,addr=0x1d -device pci-bridge,chassis_nr=249,id=pci.249,bus=pci.9,addr=0x1e -device pci-bridge,chassis_nr=250,id=pci.250,bus=pci.9,addr=0x1f -device pci-bridge,chassis_nr=251,id=pci.251,bus=pci.10,addr=0x1 -device pci-bridge,chassis_nr=252,id=pci.252,bus=pci.10,addr=0x2 -device pci-bridge,chassis_nr=253,id=pci.253,bus=pci.10,addr=0x3 -device pci-bridge,chassis_nr=254,id=pci.254,bus=pci.10,addr=0x4 -device pci-bridge,chassis_nr=255,id=pci.255,bus=pci.10,addr=0x5 -device pci-bridge,chassis_nr=256,id=pci.256,bus=pci.10,addr=0x6 -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 -device vir!
 tio-scsi-pci,id=scsi0,bus=pci.10,addr=0xa -device virtio

Actual results
Error messages are not friendly

Expected results
Actually creating vm failed due to chassis_nr out of range. So libvirt should provide proper error like this
# virsh create vm1-q35.xml
error: Failed to create domain from vm1-q35.xml
error: Parameter 'chassis_nr' out of range - must be 0-255

Additional info:

Comment 2 Laine Stump 2016-06-27 22:08:18 UTC
We do check the boundaries of chassis_nr, but that happens when parsing user input. We haven't been bounds-checking chassis_nr when the number is auto-generated.

A side note: on one hand, we apparently want to support > 256 downstream ports, but on the other hand each downstream port requires a chassis_nr, and we want chassis_nr (which is limited to 1-256) to be unique (see Bug 1349227). So which do we try to satisfy?

Comment 4 Laine Stump 2017-03-27 00:50:50 UTC
Actually we should just limit the max for PCI controller index to 256, since index is a proxy for the controller's bus number, and that is an 8 bit value.

Patch posted upstream:

https://www.redhat.com/archives/libvir-list/2017-March/msg01258.html

Comment 5 Laine Stump 2017-03-27 16:41:15 UTC
Fixed upstream:

commit 272f18563179d7372ce0a11b4425a0497cf70e93
Author: Laine Stump <laine>
Date:   Sun Mar 26 20:47:17 2017 -0400

    conf: validate that PCI controller index is < 256

Comment 7 Han Han 2017-05-02 01:09:07 UTC
Verified on libvirt-3.2.0-3.el7.x86_64.
1. Cold plug pcie-switch-upstream-port controllers to VM, index up to 256.
# cat /tmp/upstream.xml      
<controller type='pci' index='INDEX' model='pcie-switch-upstream-port'/>
# for i in $(seq 6 2 256);do 
    sed "s/INDEX/$i/g" /tmp/upstream.xml > /tmp/xx.xml
    sudo virsh attach-device q35-upstream /tmp/xx.xml --config
done

You will get a error when the index reaches 256:
error: unsupported configuration: PCI controller index 256 too high, maximum is 255
Failed. Try again? [y,n,i,f,?]: 

Or you can use 'virsh edit' to add the index to 256:
# virsh edit q35-upstream
error: unsupported configuration: PCI controller index 256 too high, maximum is 255
Failed. Try again? [y,n,i,f,?]:

Comment 8 errata-xmlrpc 2017-08-01 17:09:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846

Comment 9 errata-xmlrpc 2017-08-01 23:51:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846


Note You need to log in before you can comment on or make changes to this bug.