Bump github.com/NVIDIA/go-nvlib from 0.7.0 to 0.7.1

Bumps [github.com/NVIDIA/go-nvlib](https://github.com/NVIDIA/go-nvlib) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/NVIDIA/go-nvlib/releases)
- [Commits](https://github.com/NVIDIA/go-nvlib/compare/v0.7.0...v0.7.1)

---
updated-dependencies:
- dependency-name: github.com/NVIDIA/go-nvlib
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2025-02-13 08:33:08 +00:00 committed by GitHub
parent 9e85fb54fc
commit 0e759d4ad8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1241 additions and 195 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/NVIDIA/nvidia-container-toolkit
go 1.22.0 go 1.22.0
require ( require (
github.com/NVIDIA/go-nvlib v0.7.0 github.com/NVIDIA/go-nvlib v0.7.1
github.com/NVIDIA/go-nvml v0.12.4-1 github.com/NVIDIA/go-nvml v0.12.4-1
github.com/moby/sys/symlink v0.3.0 github.com/moby/sys/symlink v0.3.0
github.com/opencontainers/runtime-spec v1.2.0 github.com/opencontainers/runtime-spec v1.2.0

4
go.sum
View File

@ -1,5 +1,5 @@
github.com/NVIDIA/go-nvlib v0.7.0 h1:Z/J7skMdLbTiHvomKVsGYsttfQMZj5FwNYIFXhZ4i/c= github.com/NVIDIA/go-nvlib v0.7.1 h1:7HHPZxoCjSLm1NgaRRjuhI8ffMCpc5Vgpg5yxQYUff8=
github.com/NVIDIA/go-nvlib v0.7.0/go.mod h1:9UrsLGx/q1OrENygXjOuM5Ey5KCtiZhbvBlbUIxtGWY= github.com/NVIDIA/go-nvlib v0.7.1/go.mod h1:2Kh2kYSP5IJ8EKf0/SYDzHiQKb9EJkwOf2LQzu6pXzY=
github.com/NVIDIA/go-nvml v0.12.4-1 h1:WKUvqshhWSNTfm47ETRhv0A0zJyr1ncCuHiXwoTrBEc= github.com/NVIDIA/go-nvml v0.12.4-1 h1:WKUvqshhWSNTfm47ETRhv0A0zJyr1ncCuHiXwoTrBEc=
github.com/NVIDIA/go-nvml v0.12.4-1/go.mod h1:8Llmj+1Rr+9VGGwZuRer5N/aCjxGuR5nPb/9ebBiIEQ= github.com/NVIDIA/go-nvml v0.12.4-1/go.mod h1:8Llmj+1Rr+9VGGwZuRer5N/aCjxGuR5nPb/9ebBiIEQ=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=

View File

@ -86,7 +86,7 @@ func (d *device) GetArchitectureAsString() (string, error) {
case nvml.DEVICE_ARCH_AMPERE: case nvml.DEVICE_ARCH_AMPERE:
return "Ampere", nil return "Ampere", nil
case nvml.DEVICE_ARCH_ADA: case nvml.DEVICE_ARCH_ADA:
return "Ada", nil return "Ada Lovelace", nil
case nvml.DEVICE_ARCH_HOPPER: case nvml.DEVICE_ARCH_HOPPER:
return "Hopper", nil return "Hopper", nil
case nvml.DEVICE_ARCH_UNKNOWN: case nvml.DEVICE_ARCH_UNKNOWN:
@ -125,7 +125,7 @@ func (d *device) GetBrandAsString() (string, error) {
case nvml.BRAND_NVIDIA_VWS: case nvml.BRAND_NVIDIA_VWS:
return "NvidiaVWS", nil return "NvidiaVWS", nil
// Deprecated in favor of nvml.BRAND_NVIDIA_CLOUD_GAMING // Deprecated in favor of nvml.BRAND_NVIDIA_CLOUD_GAMING
//case nvml.BRAND_NVIDIA_VGAMING: // case nvml.BRAND_NVIDIA_VGAMING:
// return "VGaming", nil // return "VGaming", nil
case nvml.BRAND_NVIDIA_CLOUD_GAMING: case nvml.BRAND_NVIDIA_CLOUD_GAMING:
return "NvidiaCloudGaming", nil return "NvidiaCloudGaming", nil
@ -222,6 +222,9 @@ func (d *device) IsFabricAttached() (bool, error) {
if info.State != nvml.GPU_FABRIC_STATE_COMPLETED { if info.State != nvml.GPU_FABRIC_STATE_COMPLETED {
return false, nil return false, nil
} }
if info.ClusterUuid == [16]uint8{} {
return false, nil
}
if nvml.Return(info.Status) != nvml.SUCCESS { if nvml.Return(info.Status) != nvml.SUCCESS {
return false, nil return false, nil
} }
@ -240,6 +243,9 @@ func (d *device) IsFabricAttached() (bool, error) {
if info.State != nvml.GPU_FABRIC_STATE_COMPLETED { if info.State != nvml.GPU_FABRIC_STATE_COMPLETED {
return false, nil return false, nil
} }
if info.ClusterUuid == [16]uint8{} {
return false, nil
}
if nvml.Return(info.Status) != nvml.SUCCESS { if nvml.Return(info.Status) != nvml.SUCCESS {
return false, nil return false, nil
} }

View File

@ -280,27 +280,14 @@ func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevi
return nil, fmt.Errorf("unable to convert device string to uint16: %v", deviceStr) return nil, fmt.Errorf("unable to convert device string to uint16: %v", deviceStr)
} }
driver, err := filepath.EvalSymlinks(path.Join(devicePath, "driver")) driver, err := getDriver(devicePath)
if err == nil { if err != nil {
driver = filepath.Base(driver) return nil, fmt.Errorf("unable to detect driver for %s: %w", address, err)
} else if os.IsNotExist(err) {
driver = ""
} else {
return nil, fmt.Errorf("unable to detect driver for %s: %v", address, err)
} }
var iommuGroup int64 iommuGroup, err := getIOMMUGroup(devicePath)
iommu, err := filepath.EvalSymlinks(path.Join(devicePath, "iommu_group")) if err != nil {
if err == nil { return nil, fmt.Errorf("unable to detect IOMMU group for %s: %w", address, err)
iommuGroupStr := strings.TrimSpace(filepath.Base(iommu))
iommuGroup, err = strconv.ParseInt(iommuGroupStr, 0, 64)
if err != nil {
return nil, fmt.Errorf("unable to convert iommu_group string to int64: %v", iommuGroupStr)
}
} else if os.IsNotExist(err) {
iommuGroup = -1
} else {
return nil, fmt.Errorf("unable to detect iommu_group for %s: %v", address, err)
} }
numa, err := os.ReadFile(path.Join(devicePath, "numa_node")) numa, err := os.ReadFile(path.Join(devicePath, "numa_node"))
@ -359,7 +346,8 @@ func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevi
var sriovInfo SriovInfo var sriovInfo SriovInfo
// Device is a virtual function (VF) if "physfn" symlink exists. // Device is a virtual function (VF) if "physfn" symlink exists.
physFnAddress, err := filepath.EvalSymlinks(path.Join(devicePath, "physfn")) physFnAddress, err := filepath.EvalSymlinks(path.Join(devicePath, "physfn"))
if err == nil { switch {
case err == nil:
physFn, err := p.getGPUByPciBusID(filepath.Base(physFnAddress), cache) physFn, err := p.getGPUByPciBusID(filepath.Base(physFnAddress), cache)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to detect physfn for %s: %v", address, err) return nil, fmt.Errorf("unable to detect physfn for %s: %v", address, err)
@ -369,12 +357,12 @@ func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevi
PhysicalFunction: physFn, PhysicalFunction: physFn,
}, },
} }
} else if os.IsNotExist(err) { case os.IsNotExist(err):
sriovInfo, err = p.getSriovInfoForPhysicalFunction(devicePath) sriovInfo, err = p.getSriovInfoForPhysicalFunction(devicePath)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to read SRIOV physical function details for %s: %v", devicePath, err) return nil, fmt.Errorf("unable to read SRIOV physical function details for %s: %v", devicePath, err)
} }
} else { default:
return nil, fmt.Errorf("unable to read %s: %v", path.Join(devicePath, "physfn"), err) return nil, fmt.Errorf("unable to read %s: %v", path.Join(devicePath, "physfn"), err)
} }
@ -521,3 +509,31 @@ func (p *nvpci) getSriovInfoForPhysicalFunction(devicePath string) (sriovInfo Sr
} }
return sriovInfo, nil return sriovInfo, nil
} }
func getDriver(devicePath string) (string, error) {
driver, err := filepath.EvalSymlinks(path.Join(devicePath, "driver"))
switch {
case os.IsNotExist(err):
return "", nil
case err == nil:
return filepath.Base(driver), nil
}
return "", err
}
func getIOMMUGroup(devicePath string) (int64, error) {
var iommuGroup int64
iommu, err := filepath.EvalSymlinks(path.Join(devicePath, "iommu_group"))
switch {
case os.IsNotExist(err):
return -1, nil
case err == nil:
iommuGroupStr := strings.TrimSpace(filepath.Base(iommu))
iommuGroup, err = strconv.ParseInt(iommuGroupStr, 0, 64)
if err != nil {
return 0, fmt.Errorf("unable to convert iommu_group string to int64: %v", iommuGroupStr)
}
return iommuGroup, nil
}
return 0, err
}

View File

@ -112,7 +112,7 @@ func (mrs MemoryResources) GetTotalAddressableMemory(roundUp bool) (uint64, uint
if key >= pciIOVNumBAR || numBAR == pciIOVNumBAR { if key >= pciIOVNumBAR || numBAR == pciIOVNumBAR {
break break
} }
numBAR = numBAR + 1 numBAR++
region := mrs[key] region := mrs[key]
@ -123,10 +123,10 @@ func (mrs MemoryResources) GetTotalAddressableMemory(roundUp bool) (uint64, uint
memSize := (region.End - region.Start) + 1 memSize := (region.End - region.Start) + 1
if memType32bit { if memType32bit {
memSize32bit = memSize32bit + uint64(memSize) memSize32bit += uint64(memSize)
} }
if memType64bit { if memType64bit {
memSize64bit = memSize64bit + uint64(memSize) memSize64bit += uint64(memSize)
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -396,7 +396,7 @@ func (p *parser) parse() Interface {
hkClass = db.classes[uint32(id)] hkClass = db.classes[uint32(id)]
hkFullID = uint32(id) << 16 hkFullID = uint32(id) << 16
hkFullID = hkFullID & 0xFFFF0000 hkFullID &= 0xFFFF0000
hkFullName[0] = fmt.Sprintf("%s (%02x)", lit.name, id) hkFullName[0] = fmt.Sprintf("%s (%02x)", lit.name, id)
} }
@ -408,11 +408,11 @@ func (p *parser) parse() Interface {
} }
hkSubClass = hkClass.subClasses[uint32(id)] hkSubClass = hkClass.subClasses[uint32(id)]
// Clear the last detected sub class. // Clear the last detected subclass.
hkFullID = hkFullID & 0xFFFF0000 hkFullID &= 0xFFFF0000
hkFullID = hkFullID | uint32(id)<<8 hkFullID |= uint32(id) << 8
// Clear the last detected prog iface. // Clear the last detected prog iface.
hkFullID = hkFullID & 0xFFFFFF00 hkFullID &= 0xFFFFFF00
hkFullName[1] = fmt.Sprintf("%s (%02x)", lit.name, id) hkFullName[1] = fmt.Sprintf("%s (%02x)", lit.name, id)
db.classes[uint32(hkFullID)] = class{ db.classes[uint32(hkFullID)] = class{

2
vendor/modules.txt vendored
View File

@ -1,4 +1,4 @@
# github.com/NVIDIA/go-nvlib v0.7.0 # github.com/NVIDIA/go-nvlib v0.7.1
## explicit; go 1.20 ## explicit; go 1.20
github.com/NVIDIA/go-nvlib/pkg/nvlib/device github.com/NVIDIA/go-nvlib/pkg/nvlib/device
github.com/NVIDIA/go-nvlib/pkg/nvlib/info github.com/NVIDIA/go-nvlib/pkg/nvlib/info