Documentation
¶
Overview ¶
Package nvproxy implements proxying for the Nvidia GPU Linux kernel driver: https://github.com/NVIDIA/open-gpu-kernel-modules.
Supported Nvidia GPUs: T4, L4, A100, A10G and H100.
Lock ordering:
- nvproxy.fdsMu - rootClient.objsMu
- nvproxy.clientsMu
Index ¶
- Constants
- func Filters(enabledCaps nvconf.DriverCaps) seccomp.SyscallRules
- func ForEachSupportDriver(f func(version nvconf.DriverVersion, checksums Checksums))
- func HostDriverVersion() (string, error)
- func Init()
- func LatestDriver() nvconf.DriverVersion
- func SupportedDrivers() []nvconf.DriverVersion
- func SupportedIoctlsNumbers(version nvconf.DriverVersion) (frontendIoctls map[uint32]struct{}, uvmIoctls map[uint32]struct{}, ...)
- type Checksums
- type DeviceInfo
- type DriverABIInfo
- type DriverStruct
- type DriverStructName
- type IoctlInfo
- type IoctlName
- type NvidiaDeviceFD
- type Options
- type ProcfsInfo
Constants ¶
const ( // ChecksumNoDriver is a special value that indicates that the driver runfile does not exist. This // is mostly for ARM drivers that NVIDIA does not provide a driver installer. ChecksumNoDriver = "NO_DRIVER" )
Variables ¶
This section is empty.
Functions ¶
func Filters ¶
func Filters(enabledCaps nvconf.DriverCaps) seccomp.SyscallRules
Filters returns seccomp-bpf filters for this package when using the given set of capabilities.
func ForEachSupportDriver ¶
func ForEachSupportDriver(f func(version nvconf.DriverVersion, checksums Checksums))
ForEachSupportDriver calls f on all supported drivers. Precondition: Init() must have been called.
func HostDriverVersion ¶
HostDriverVersion returns the version of the host Nvidia driver.
func LatestDriver ¶
func LatestDriver() nvconf.DriverVersion
LatestDriver returns the latest supported driver. Precondition: Init() must have been called.
func SupportedDrivers ¶
func SupportedDrivers() []nvconf.DriverVersion
SupportedDrivers returns a list of all supported drivers. Precondition: Init() must have been called.
func SupportedIoctlsNumbers ¶
func SupportedIoctlsNumbers(version nvconf.DriverVersion) (frontendIoctls map[uint32]struct{}, uvmIoctls map[uint32]struct{}, controlCmds map[uint32]struct{}, allocClasses map[uint32]struct{}, ok bool)
SupportedIoctlsNumbers returns the ioctl numbers that are supported by nvproxy at a given version.
Types ¶
type Checksums ¶
type Checksums struct {
// contains filtered or unexported fields
}
Checksums is a struct containing the SHA256 checksum of the linux .run driver installer file from NVIDIA.
func ExpectedDriverChecksum ¶
func ExpectedDriverChecksum(version nvconf.DriverVersion) (Checksums, bool)
ExpectedDriverChecksum returns the expected checksum for a given version. Precondition: Init() must have been called.
func NewChecksums ¶
NewChecksums creates a new Checksums struct.
func (Checksums) Arm64 ¶
Arm64 returns the SHA256 checksum of the linux .run driver installer file from NVIDIA for ARM64.
type DeviceInfo ¶
type DeviceInfo struct {
// CapsDevMajor is nvidia-caps' device major number. If CapsDevMajor is 0,
// nvidia-caps is not enabled.
CapsDevMajor uint32
// If HaveFabricIMEXManagement is true, FabricIMEXManagementDevMinor is the
// fabric-imex-mgmt capability's device minor number, which matches the
// value on the host. (Its device major number is CapsDevMajor, which must
// be non-zero and might not match the host's value.)
HaveFabricIMEXManagement bool
FabricIMEXManagementDevMinor uint32
// CapsIMEXChannelsDevMajor is nvidia-caps-imex-channels's device major
// number. If CapsIMEXChannelsDevMajor is 0, nvidia-caps-imex-channels is
// not enabled.
CapsIMEXChannelsDevMajor uint32
// UVMDevMajor is nvidia-uvm's device major number. If UVMDevMajor is 0,
// nvidia-uvm is enabled.
UVMDevMajor uint32
}
DeviceInfo contains information on registered nvproxy devices.
+stateify savable
func DeviceInfoFromVFS ¶
func DeviceInfoFromVFS(vfsObj *vfs.VirtualFilesystem) *DeviceInfo
DeviceInfoFromVFS returns device information for nvproxy devices registered in vfsObj. The returned DeviceInfo must not be mutated. If DeviceInfoFromVFS returns nil, nvproxy.Register(vfsObj) has not been called.
func Register ¶
func Register(vfsObj *vfs.VirtualFilesystem, opts *Options) (*DeviceInfo, error)
Register registers all devices implemented by this package, and specified by opts, in vfsObj. If it succeeds, it returns information about registered devices; the returned DeviceInfo must not be mutated.
type DriverABIInfo ¶
type DriverABIInfo struct {
FrontendInfos map[uint32]IoctlInfo
UvmInfos map[uint32]IoctlInfo
ControlInfos map[uint32]IoctlInfo
AllocationInfos map[nvgpu.ClassID]IoctlInfo
}
DriverABIInfo defines all the structs and ioctls used by a driverABI. This is used to help with verifying and supporting new driver versions. This helps keep track of all the driver structs and ioctls that we currently support. We do so by mapping ioctl numbers to its name in the driver and a list of DriverStructs used by that ioctl.
func SupportedIoctls ¶
func SupportedIoctls(version nvconf.DriverVersion) (*DriverABIInfo, bool)
SupportedIoctls returns the DriverABIInfo struct for the given version, which describes the ioctls supported in nvproxy for the given version.
type DriverStruct ¶
type DriverStruct struct {
Name DriverStructName
Type reflect.Type
}
DriverStruct ties an nvproxy struct type to its corresponding driver struct name.
type DriverStructName ¶
type DriverStructName = string
DriverStructName is the name of a struct used by the Nvidia driver.
type IoctlInfo ¶
type IoctlInfo struct {
Name IoctlName
Structs []DriverStruct
}
IoctlInfo contains information about an ioctl defined by the Nvidia driver.
type IoctlName ¶
type IoctlName = string
IoctlName is the name of the constant used by the Nvidia driver to define the ioctl number/control command/allocation class.
type NvidiaDeviceFD ¶
type NvidiaDeviceFD interface {
IsNvidiaDeviceFD()
}
NvidiaDeviceFD is an interface that should be implemented by all vfs.FileDescriptionImpl of Nvidia devices.
type Options ¶
type Options struct {
// DriverVersion is the Nvidia GPU driver version.
DriverVersion nvconf.DriverVersion
// DriverCaps is the set of driver capabilities exposed to applications.
DriverCaps nvconf.DriverCaps
HostSettings *nvconf.HostSettings
// If UseDevGofer is true, open device files via gofer.
UseDevGofer bool
}
Options holds arguments to Register.
type ProcfsInfo ¶
type ProcfsInfo struct {
// StaticFiles maps paths relative to /proc/driver/nvidia/ to the contents of
// files at those paths.
StaticFiles map[string]string
}
ProcfsInfo contains information about procfs files maintained by nvproxy.
func ProcfsInfoFromVFS ¶
func ProcfsInfoFromVFS(vfsObj *vfs.VirtualFilesystem) *ProcfsInfo
ProcfsInfoFromVFS returns procfs information for nvproxy devices registered in vfsObj. If ProcfsInfoFromVFS returns nil, nvproxy.Register(vfsObj) has not been called.