Skip to content

Commit

Permalink
Set kernel param 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 "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 <[email protected]>
  • Loading branch information
wizhaoredhat committed Aug 3, 2023
1 parent 7685fcf commit f63b13d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/plugins/generic/generic_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func (p *GenericPlugin) Apply() error {
}

if err := utils.SyncNodeState(p.DesireState, pfsToSkip); err != nil {
if strings.Contains(err.Error(), "cannot allocate memory") {
p.AddToDesiredKernelParams(utils.KernelParamPciRealloc)
}
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 @@ -42,6 +42,7 @@ const (
DeviceBF2 = "a2d6"
DeviceBF3 = "a2dc"

KernelParamPciRealloc = "pci=realloc"
KernelParamIntelIommu = "intel_iommu=on"
KernelParamIommuPt = "iommu=pt"
)
Expand Down

0 comments on commit f63b13d

Please sign in to comment.