Skip to content

Commit

Permalink
Set kernel arg PCI realloc on "cannot allocate memory" on VF creation
Browse files Browse the repository at this point in the history
When creating VFs via sysfs sriov_numvfs, there is a chance of getting
the error syscall.ENOMEM/"cannot allocate memory". This could occur when
the BIOS is not providing enough MMIO space for VFs. A solution is to
reallocate the MMIO space via "pci=realloc".

Signed-off-by: William Zhao <wizhao@redhat.com>
  • Loading branch information
wizhaoredhat committed Oct 12, 2023
1 parent 2d6a3b9 commit 882dee0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/plugins/generic/generic_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package generic

import (
"bytes"
"errors"
"os/exec"
"reflect"
"strconv"
Expand Down Expand Up @@ -173,6 +174,10 @@ func (p *GenericPlugin) Apply() error {
}

if err := utils.SyncNodeState(p.DesireState, pfsToSkip); err != nil {
// Catch the "cannot allocate memory" error and try to use PCI realloc
if errors.Is(err, syscall.ENOMEM) {
p.addToDesiredKernelArgs(utils.KernelArgPciRealloc)
}
return err
}
p.LastState = &sriovnetworkv1.SriovNetworkNodeState{}
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const (
udevDisableNM = "/bindata/scripts/udev-find-sriov-pf.sh"
nmUdevRule = "SUBSYSTEM==\"net\", ACTION==\"add|change|move\", ATTRS{device}==\"%s\", IMPORT{program}=\"/etc/udev/disable-nm-sriov.sh $env{INTERFACE} %s\""

KernelArgPciRealloc = "pci=realloc"
KernelArgIntelIommu = "intel_iommu=on"
KernelArgIommuPt = "iommu=pt"
)
Expand Down

0 comments on commit 882dee0

Please sign in to comment.