Re: [RFC 0/4] pci/sriov: support VFs dynamic addition

From: Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
Date: Tue Nov 15 2022 - 19:52:38 EST


Hi Oliver,

在 2022/11/15 10:06, Oliver O'Halloran 写道:
On Tue, Nov 15, 2022 at 1:08 AM Longpeng (Mike, Cloud Infrastructure
Service Product Dept.) <longpeng2@xxxxxxxxxx> wrote:

*snip*

Adding 2K+ VFs to the sysfs need too much time.

Look at the bottomhalf of the hypervisor live update:
kexec --> add 2K VFs --> restore VMs

The downtime can be reduced if the sequence is:
kexec --> add 100 VFs(the VMs used) --> resotre VMs --> add 1.9K VFs

Right, so you want to add VFs in batches rather than all at once.
Personally I think the bitmap approach is error prone since it renders
the meaning of pf_dev->sriov->num_VFs unclear and there's some hairy
code in arch/powerpc/ that approach will likely break. A better

I ran a quick search in the arch/powerpc/, do you mean the pseries_call_allow_unfreeze ? Or would you please point the code?

approach would be to add an attribute to control the number of VFs
enabled in hardware and allowing sriov_numvfs to accept any number
between the current value and sriov_hw_numvfs. e.g. your HV setup

Oh, this is a constructive suggestion, I'll try in the next step.

would look something like:

echo 2048 > sriov_hw_numvfs
echo 100 > sriov_numvfs

It's fixed to add the first 100 VFs first, maybe providing an interface that users can specify which id or which range of ids to be added first would be better?

# time passes
echo 2048 > sriov_numvfs

This would be fairly simple to implement and you can make it backwards
compatible by having writes to sriov_numvfs retain their current
semantics if sriov_hw_numvfs is zero.
.