On 05/10/2026 20:19, Laine Stump wrote:

When a new domain is created and no busNr is given, the default value decided on by libvirt at that time is written into the XML, so subsequent starts of that particular domain using that definition will use the same busNr - only newly created domains will get a different default busNr than they used to. So in that case, this change in default setting has 0 effect.

There are management stacks that re-create the XML for every power on, so every power cycle these VMs would see different SBDFs across the libvirt upgrade and some VMs (e.g., Windows) get upset if SBDFs change (of which I'm sure you're aware).

If you think management stacks that do that should also take care of the busNr allocations then I personally find that acceptable (as the management stack I care about already does this), but I'm not sure I'd want to make assumptions about the behaviour of every one.

So whilst I agree that the current bus number allocation algorithm isn't very useful, I do think a new algorithm needs to be explicitly requested by the user or management stack.

You could have something like:

<controller type='pci' index='1' model='pcie-expander-bus'>
  <model name='pxb-pcie'/>
  <target busNr='+16'/>
  ...

Where the +16 means reserve 16 "spare" bus numbers for downstream devices/ports, without having to care about exactly which bus numbers are allocated. The default value is the current behaviour of "+2".

If you wish to continue with the patch as-is, I think the description could benefit from a clearer description of the current allocation algorithm (e.g., clarify that numbering starts from the highest bus and goes down).

David

Reply via email to