sriov

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecQuantumMax = 64
	// Name of the profile in Profiles that resets VF to fair-share provisioning.
	FairShareProfile = "fairShare"
)

Variables

View Source
var PerDeviceIdDefaultProfiles = map[string]string{

	"0x56c0": "flex170_m8",

	"0x56c1": "flex140_m6",

	"0x0b69": "max_128g_c16",

	"0x0bd0": "max_128g_c16",

	"0x0bd5": "max_128g_c16",

	"0x0bd6": "max_128g_c16",

	"0x0bd9": "max_48g_c8",

	"0x0bda": "max_48g_c8",

	"0x0bdb": "max_48g_c8",
}

PerDeviceIdDefaultProfiles specifies name of default profile that should be used for particular PCI deviceId.

View Source
var PerDeviceIdProfiles = map[string][]string{

	"0x56c0": {"flex170_m1", "flex170_m2", "flex170_m4", "flex170_m5", "flex170_m8", "flex170_m16"},

	"0x56c1": {"flex140_m1", "flex140_m3", "flex140_m6", "flex140_m12"},

	"0x0b69": {"max_128g_c1", "max_128g_c2", "max_128g_c4", "max_128g_c8", "max_128g_c16", "max_128g_c32", "max_128g_c62"},

	"0x0bd0": {"max_128g_c1", "max_128g_c2", "max_128g_c4", "max_128g_c8", "max_128g_c16", "max_128g_c32", "max_128g_c62"},

	"0x0bd5": {"max_128g_c1", "max_128g_c2", "max_128g_c4", "max_128g_c8", "max_128g_c16", "max_128g_c32", "max_128g_c62"},

	"0x0bd6": {"max_128g_c1", "max_128g_c2", "max_128g_c4", "max_128g_c8", "max_128g_c16", "max_128g_c32", "max_128g_c62"},

	"0x0bd9": {"max_48g_c1", "max_48g_c2", "max_48g_c4", "max_48g_c8", "max_48g_c16", "max_48g_c32", "max_48g_c63"},

	"0x0bda": {"max_48g_c1", "max_48g_c2", "max_48g_c4", "max_48g_c8", "max_48g_c16", "max_48g_c32", "max_48g_c63"},

	"0x0bdb": {"max_48g_c1", "max_48g_c2", "max_48g_c4", "max_48g_c8", "max_48g_c16", "max_48g_c32", "max_48g_c63"},
}

PerDeviceIdProfiles has to be ordered descending by size, the profile picking logic relies on this.

View Source
var Profiles = map[string]map[string]uint64{

	"flex170_m1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         16777216000,
		"lmem_quota_ecc_on":  14199816192,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"flex170_m2": {
		"contexts_quota":     1024,
		"doorbells_quota":    120,
		"exec_quantum_ms":    32,
		"ggtt_quota":         2013265920,
		"lmem_quota":         8388608000,
		"lmem_quota_ecc_on":  7098859520,
		"preempt_timeout_us": 64000,
		"numvfs":             2,
	},
	"flex170_m4": {
		"contexts_quota":     1024,
		"doorbells_quota":    60,
		"exec_quantum_ms":    16,
		"ggtt_quota":         1006632960,
		"lmem_quota":         4194304000,
		"lmem_quota_ecc_on":  3548381184,
		"preempt_timeout_us": 32000,
		"numvfs":             4,
	},
	"flex170_m5": {
		"contexts_quota":     1024,
		"doorbells_quota":    48,
		"exec_quantum_ms":    12,
		"ggtt_quota":         805306368,
		"lmem_quota":         3355443200,
		"lmem_quota_ecc_on":  2839543808,
		"preempt_timeout_us": 24000,
		"numvfs":             5,
	},
	"flex170_m8": {
		"contexts_quota":     1024,
		"doorbells_quota":    30,
		"exec_quantum_ms":    8,
		"ggtt_quota":         503316480,
		"lmem_quota":         2097152000,
		"lmem_quota_ecc_on":  1774190592,
		"preempt_timeout_us": 16000,
		"numvfs":             8,
	},
	"flex170_m16": {
		"contexts_quota":     1024,
		"doorbells_quota":    15,
		"exec_quantum_ms":    4,
		"ggtt_quota":         251658240,
		"lmem_quota":         1048576000,
		"lmem_quota_ecc_on":  887095296,
		"preempt_timeout_us": 8000,
		"numvfs":             16,
	},

	"flex140_m1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         6039797760,
		"lmem_quota_ecc_on":  4880072704,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"flex140_m3": {
		"contexts_quota":     1024,
		"doorbells_quota":    80,
		"exec_quantum_ms":    22,
		"ggtt_quota":         1342177280,
		"lmem_quota":         2013265920,
		"lmem_quota_ecc_on":  1625292800,
		"preempt_timeout_us": 44000,
		"numvfs":             3,
	},
	"flex140_m6": {
		"contexts_quota":     1024,
		"doorbells_quota":    40,
		"exec_quantum_ms":    16,
		"ggtt_quota":         671088640,
		"lmem_quota":         1006632960,
		"lmem_quota_ecc_on":  811597824,
		"preempt_timeout_us": 32000,
		"numvfs":             6,
	},
	"flex140_m12": {
		"contexts_quota":     1024,
		"doorbells_quota":    20,
		"exec_quantum_ms":    8,
		"ggtt_quota":         335544320,
		"lmem_quota":         503316480,
		"lmem_quota_ecc_on":  404750336,
		"preempt_timeout_us": 16000,
		"numvfs":             12,
	},

	"max_128g_c1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         64424509440,
		"lmem_quota_ecc_on":  64424509440,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"max_128g_c2": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         2013265920,
		"lmem_quota":         32212254720,
		"lmem_quota_ecc_on":  32212254720,
		"preempt_timeout_us": 128000,
		"numvfs":             2,
	},
	"max_128g_c4": {
		"contexts_quota":     1024,
		"doorbells_quota":    120,
		"exec_quantum_ms":    64,
		"ggtt_quota":         1006632960,
		"lmem_quota":         16106127360,
		"lmem_quota_ecc_on":  16106127360,
		"preempt_timeout_us": 128000,
		"numvfs":             4,
	},
	"max_128g_c8": {
		"contexts_quota":     1024,
		"doorbells_quota":    60,
		"exec_quantum_ms":    32,
		"ggtt_quota":         503316480,
		"lmem_quota":         8053063680,
		"lmem_quota_ecc_on":  8053063680,
		"preempt_timeout_us": 64000,
		"numvfs":             8,
	},
	"max_128g_c16": {
		"contexts_quota":     1024,
		"doorbells_quota":    30,
		"exec_quantum_ms":    16,
		"ggtt_quota":         251658240,
		"lmem_quota":         4026531840,
		"lmem_quota_ecc_on":  4026531840,
		"preempt_timeout_us": 32000,
		"numvfs":             16,
	},
	"max_128g_c32": {
		"contexts_quota":     1024,
		"doorbells_quota":    15,
		"exec_quantum_ms":    8,
		"ggtt_quota":         125829120,
		"lmem_quota":         2013265920,
		"lmem_quota_ecc_on":  2013265920,
		"preempt_timeout_us": 16000,
		"numvfs":             32,
	},
	"max_128g_c62": {
		"contexts_quota":     1024,
		"doorbells_quota":    7,
		"exec_quantum_ms":    4,
		"ggtt_quota":         64880640,
		"lmem_quota":         1038090240,
		"lmem_quota_ecc_on":  1038090240,
		"preempt_timeout_us": 8000,
		"numvfs":             62,
	},
	"max_48g_c1": {
		"contexts_quota":     1024,
		"doorbells_quota":    240,
		"exec_quantum_ms":    64,
		"ggtt_quota":         4026531840,
		"lmem_quota":         47244640256,
		"lmem_quota_ecc_on":  47244640256,
		"preempt_timeout_us": 128000,
		"numvfs":             1,
	},
	"max_48g_c2": {
		"contexts_quota":     1024,
		"doorbells_quota":    120,
		"exec_quantum_ms":    64,
		"ggtt_quota":         2013265920,
		"lmem_quota":         23622320128,
		"lmem_quota_ecc_on":  23622320128,
		"preempt_timeout_us": 128000,
		"numvfs":             2,
	},
	"max_48g_c4": {
		"contexts_quota":     1024,
		"doorbells_quota":    60,
		"exec_quantum_ms":    64,
		"ggtt_quota":         1006632960,
		"lmem_quota":         11811160064,
		"lmem_quota_ecc_on":  11811160064,
		"preempt_timeout_us": 128000,
		"numvfs":             4,
	},
	"max_48g_c8": {
		"contexts_quota":     1024,
		"doorbells_quota":    30,
		"exec_quantum_ms":    32,
		"ggtt_quota":         503316480,
		"lmem_quota":         5905580032,
		"lmem_quota_ecc_on":  5905580032,
		"preempt_timeout_us": 64000,
		"numvfs":             8,
	},
	"max_48g_c16": {
		"contexts_quota":     1024,
		"doorbells_quota":    15,
		"exec_quantum_ms":    16,
		"ggtt_quota":         251658240,
		"lmem_quota":         2952790016,
		"lmem_quota_ecc_on":  2952790016,
		"preempt_timeout_us": 32000,
		"numvfs":             16,
	},
	"max_48g_c32": {
		"contexts_quota":     1024,
		"doorbells_quota":    7,
		"exec_quantum_ms":    8,
		"ggtt_quota":         125829120,
		"lmem_quota":         1476395008,
		"lmem_quota_ecc_on":  1476395008,
		"preempt_timeout_us": 16000,
		"numvfs":             32,
	},
	"max_48g_c63": {
		"contexts_quota":     1024,
		"doorbells_quota":    3,
		"exec_quantum_ms":    4,
		"ggtt_quota":         63897600,
		"lmem_quota":         738197504,
		"lmem_quota_ecc_on":  738197504,
		"preempt_timeout_us": 8000,
		"numvfs":             63,
	},
	FairShareProfile: {
		"contexts_quota":     0,
		"doorbells_quota":    0,
		"exec_quantum_ms":    0,
		"ggtt_quota":         0,
		"lmem_quota":         0,
		"lmem_quota_ecc_on":  0,
		"preempt_timeout_us": 0,
		"numvfs":             0,
	},
}

Profiles is a set of all supported profiles and per-sysfs-file values.

View Source
var VfAttributeFiles = []string{
	"contexts_quota",
	"doorbells_quota",
	"exec_quantum_ms",
	"ggtt_quota",
	"lmem_quota",
	"preempt_timeout_us",
}

VfAttributeFiles is a list of filenames that needs to be configured for a VF profile to be applied.

Functions

func CleanupManualConfigurationMaybe

func CleanupManualConfigurationMaybe(sysfsVFsDir string, numVFs uint64) error

CleanupManualConfigurationMaybe checks if "pf/auto_provisioning" (under given sysfsVFsDir) is disabled before unconfiguring requested VFs. If VFs were successfully unconfigured, auto_provisioning is enabled.

func DeduceVFMillicores added in v0.3.0

func DeduceVFMillicores(parentI915Dir string, cardIdx uint64, pciVFIndex uint64, vfMemMiB uint64, deviceID string) (uint64, error)

DeduceVFMillicores returns relative amount of millicores based on either of: - number of provisioned VFs, if auto_provisioning is enabled; - memory allocated to the VF, if auto_provisioning is disabled.

func DeviceProfileExists

func DeviceProfileExists(deviceId string, profileName string) bool

DeviceProfileExists returns true if given profileName is found for deviceId in PerDeviceIdProfiles, or false.

func GetMaximumVFDoorbells

func GetMaximumVFDoorbells(deviceId string) uint64

GetMaximumVFDoorbells returns amount of doorbells the biggest profile for deviceId has.

func GetMaximumVFMemorySizeMiB

func GetMaximumVFMemorySizeMiB(deviceId string, eccOn bool) (uint64, error)

GetMaximumVFMemorySizeMiB returns amount of memory in MiB that the largest profile for deviceId has.

func GetMimimumVFDoorbells

func GetMimimumVFDoorbells(deviceId string) uint64

GetMinimumVFDoorbells returns amount of doorbells the smallest profile for deviceId has.

func GetMimimumVFMemorySizeMiB

func GetMimimumVFMemorySizeMiB(deviceId string, eccOn bool) (uint64, error)

GetMimimumVFMemorySizeMiB returns amount of memory in MiB that the smallest profile for deviceId has.

func GetProfileDoorbells

func GetProfileDoorbells(profileName string) uint64

GetProfileDoorbells returns amount of doorbells the profile has.

func GetVFDefaults

func GetVFDefaults(deviceId string, eccOn bool) (uint64, uint64, string, error)

GetVFDefaults returns default VF memory amount in MiB and profile name for a given deviceId.

func MaxFairVFs

func MaxFairVFs(deviceId string, vfs []int) (int, error)

MaxFairVFs returns the maximum number of VFs that PF resources can be split fairly into, for the requested VF combination. Example 1: 16 GiB GPU memory can be split into 4, 4, 4, 4 to serve two VFs that requested 2 and 4 GiB respectively. Four VFs can be provisioned by simple fair-share provisioning. Example 2: 16GiB GPU memory cannot be evenly split to server VFs that requested 8, 2, 2 GiB respectively because minimum fair-share split 16 / 3 would yield less memory (5.3 GiB) per VF than the biggest memory request (8).

func PickVFProfile

func PickVFProfile(deviceId string, requestMemoryMiB uint64, requestMillicores uint64, eccOn bool) (uint64, uint64, string, error)

PickVFProfile selects suitable VF profile based on memory request. Returns VF memory in MiB, profile name and error. Can be used in case fair share is not suitable.

func PreConfigureVF

func PreConfigureVF(sysfsVFsDir string, drmVFIndex uint64, vfProfile string, eccOn bool) error

PreConfigureVF sets custom VF settings from profile for manual provisioning mode for cases when fair share is not suitable. pf/auto_provisioning will be automatically set to 0 by KMD in this case.

func ProfileMemoryMiB added in v0.3.0

func ProfileMemoryMiB(profileName string, eccOn bool) (uint64, error)

ProfileMemoryMiB returns amount of memory in MiB given profile provides if it exists, or error.

func SanitizeLmemQuotaMiB

func SanitizeLmemQuotaMiB(deviceId string, eccOn bool, lmemQuotaMiB uint64) bool

SanitizeLmemQuotaMiB returns true is requested amount of lmemQuota in MiB is supported by at least one profile for deviceId, otherwise false.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL