[libvirt] Analysis of the effect of adding PCIe root ports

Laine Stump laine at laine.org
Thu Oct 6 16:43:25 UTC 2016


On 10/06/2016 11:20 AM, Richard W.M. Jones wrote:
> On Thu, Oct 06, 2016 at 10:00:39AM -0400, Laine Stump wrote:
>> * <controller type='usb' model='blah'> x 4 - a set of USB2
>> controllers. This will turn into a single USB3 controller on a
>> root-port after my patches. Alternately, since it seems you don't
>> use it, you could eliminate it with:
> Yup, this is auto-added, and a mistake.
>
> I have sent a patch upstream adding:
>
>>       <controller type='usb' model='none'/>
>>      <memballoon model='none'/>
> ...
>> 1) virtio-scsi controller
>> 2) virtio-serial controller
>>
>> and nothing else. Manually address those two to be on bus 0
>> (pcie-root), and (with my patches) you've reduced your PCI
>> device+controller count from the current 10 down to 3 (including the
>> sata controller).
> Interesting.  Is there any particular reason why we should or should
> not use explicit PCI addresses for the remaining devices?  What would
> you recommend we do?

For 440fx it makes no difference. For Q35 it can eliminate the "extra 
PCI controllers" - current upstream libvirt will add a 
dmi-to-pci-bridge, then a pci-bridge plugged into that, and add your PCI 
devices to that; after my in-progress patches, libvirt will add a 
pcie-root-port for each virtio device, and plug them into those. If you 
manually address the devices to "some unused slot on bus 0", then they 
will be directly plugged into pcie-root, and no extra controllers will 
be needed.

As far as recommendations, I guess you could manually assign addresses 
for those two devices that would otherwise be open in both 440fx and 
Q35. Generally 00:1 (chipset devices) and 00:2 (video) are in use on a 
440fx domain, and 00:1 (video) and 00:1F (chipset devices) on a Q35. If 
you don't disable USB, then USB controllers will also be added at 00:3 
(?) on 440fx) and 00:1D on Q35; but you don't use USB so you don't need 
to worry about this. So you could just manually assign the virtio-scsi 
and virtio-serial devices to have these two addresses:

    <address type='pci' bus='0' slot='3'/>
    <address type='pci' bus='0' slot='4'/>

(domain and function default to '0' if not specified - in older libvirt 
they were required by the RNG, but otherwise optional, in new libvirt 
they're completely optional). That should work for both machinetypes and 
not cause any of the stupid outdated "you won't be able to add a video 
device in the future!" warnings.




More information about the libvir-list mailing list