fix gpu nfdhook numa labeling

Numa labeling only worked when card numbering started from 0.

Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>
This commit is contained in:
Ukri Niemimuukko 2022-11-22 18:18:52 +02:00 committed by Mikko Ylinen
parent 183675e16b
commit e199f8d181
2 changed files with 37 additions and 1 deletions

View File

@ -463,7 +463,7 @@ func createNumaNodeMappingLabel(mapping map[int][]string) string {
sort.Ints(numas)
for numaNode := range numas {
for _, numaNode := range numas {
gpus := mapping[numaNode]
numaString := strconv.FormatInt(int64(numaNode), 10)
gpusString := strings.Join(gpus, ".")

View File

@ -537,6 +537,42 @@ func getTestCases() []testcase {
"gpu.intel.com/numa-gpu-map": "0-0_1-1",
},
},
{
sysfsdirs: []string{
"card0/device/drm/card0",
"card1/device/drm/card1",
"card1/gt/gt0",
},
sysfsfiles: map[string][]byte{
"card0/device/vendor": []byte("0xfefe"),
"card0/device/numa_node": []byte("0"),
"card1/device/vendor": []byte("0x8086"),
"card1/lmem_total_bytes": []byte("8000"),
"card1/device/numa_node": []byte("1"),
},
name: "successful labeling with one 0x8086 card and numa node info",
memoryOverride: 16000000000,
capabilityFile: map[string][]byte{
"1/i915_capabilities": []byte(
"platform: newnew\n" +
"gen: 9"),
},
expectedRetval: nil,
expectedLabels: labelMap{
"gpu.intel.com/graphics_version": "9",
"gpu.intel.com/media_version": "9",
"gpu.intel.com/millicores": "1000",
"gpu.intel.com/memory.max": "8000",
"gpu.intel.com/platform_newnew.count": "1",
"gpu.intel.com/platform_newnew.present": "true",
"gpu.intel.com/platform_newnew.tiles": "1",
"gpu.intel.com/platform_gen": "9",
"gpu.intel.com/gpu-numbers": "1",
"gpu.intel.com/cards": "card1",
"gpu.intel.com/tiles": "1",
"gpu.intel.com/numa-gpu-map": "1-1",
},
},
{
sysfsdirs: []string{
"card0/device/drm/card0",