Activating virtual functions may fail with errors. Use these examples to resolve common problems.
write error: Cannot allocate memory
It may fail with the following error with some old servers or some servers with old BIOS
versions.
echo $NUMVF > /sys/bus/pci/devices/$DEV/sriov_numvfs -bash: echo: write error: Cannot allocate memoryYou will find the following error messages in /var/log/dmesg:
vfio-pci 0000:03:00.0: sriov configure (res=3) vfio-pci 0000:03:00.0: not enough MMIO resources for SR-IOV vfio-pci 0000:03:00.0: sriov configure (res=-12)It is because the BIOS is not providing enough MMIO space for VFs. You may have to upgrade BIOS. This issue can also be resolved by adding the kernel parameter, pci=realloc. It enables reallocating PCI bridge resources to accommodate required resource. Edit the /etc/default/grub file and append the following kernel parameter to the existing GRUB_CMDLINE_LINUX line.
pci=reallocUpdate grub and reboot the server.
grub2-mkconfig -o /boot/grub2/grub.cfg rebootVerify the kernel parameters.
cat /proc/cmdline
cannot overwrite existing file
It may fail with the following
error.
echo $NUMVF > /sys/bus/pci/devices/$DEV/sriov_numvfs -bash: /sys/bus/pci/devices/<device_ID>/sriov_numvfs: cannot overwrite existing fileIt is most likely because the noclobber option is enabled by default. To check this option, run:
set -o | grep noclobberAn output example
noclobber onThis means that overwriting the contents of a file using shell redirection ( the > and >> operators) is not allowed in a command line interface. To disable the noclobber option, run:
set +o noclobberOr you can bypass the noclobber restriction by using the >| redirection operator.
echo $NUMVF >| /sys/bus/pci/devices/$DEV/sriov_numvfs