Skip to content

Commit

Permalink
enable CC mode
Browse files Browse the repository at this point in the history
Co-authored-by: Malte Poll <[email protected]>
  • Loading branch information
derpsteb and malt3 committed Feb 5, 2024
1 parent 5fa2908 commit 9af5108
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions pkg/abi/nvgpu/uvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
UVM_REGISTER_GPU = 37
UVM_UNREGISTER_GPU = 38
UVM_PAGEABLE_MEM_ACCESS = 39
UVM_SET_PREFERRED_LOCATION = 42
UVM_DISABLE_READ_DUPLICATION = 45
UVM_MAP_DYNAMIC_PARALLELISM_REGION = 65
UVM_ALLOC_SEMAPHORE_POOL = 68
Expand Down Expand Up @@ -188,6 +189,15 @@ type UVM_PAGEABLE_MEM_ACCESS_PARAMS struct {
RMStatus uint32
}

// +marshal
type UVM_SET_PREFERRED_LOCATION_PARAMS struct {
RequestedBase uint64
Length uint64
NvProcessorUUID [16]uint8
RMStatus uint32
Pad0 [4]byte
}

// +marshal
type UVM_DISABLE_READ_DUPLICATION_PARAMS struct {
RequestedBase uint64
Expand Down
4 changes: 4 additions & 0 deletions pkg/sentry/devices/nvproxy/seccomp_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func Filters() seccomp.SyscallRules {
seccomp.NonNegativeFD{},
seccomp.EqualTo(nvgpu.UVM_PAGEABLE_MEM_ACCESS),
},
seccomp.PerArg{
seccomp.NonNegativeFD{},
seccomp.EqualTo(nvgpu.UVM_SET_PREFERRED_LOCATION),
},
seccomp.PerArg{
seccomp.NonNegativeFD{},
seccomp.EqualTo(nvgpu.UVM_DISABLE_READ_DUPLICATION),
Expand Down
7 changes: 4 additions & 3 deletions pkg/sentry/devices/nvproxy/uvm_mmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ func (fd *uvmFD) ConfigureMMap(ctx context.Context, opts *memmap.MMapOpts) error
// UVM_VALIDATE_VA_RANGE, and probably other ioctls, expect that
// application mmaps of /dev/nvidia-uvm are immediately visible to the
// driver.
if opts.PlatformEffect < memmap.PlatformEffectPopulate {
opts.PlatformEffect = memmap.PlatformEffectPopulate
}
// if opts.PlatformEffect < memmap.PlatformEffectPopulate {
// opts.PlatformEffect = memmap.PlatformEffectPopulate
// }
opts.PlatformEffect = memmap.PlatformEffectCommit
return vfs.GenericConfigureMMap(&fd.vfsfd, fd, opts)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/sentry/devices/nvproxy/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ func Init() {
nvgpu.UVM_REGISTER_GPU: uvmIoctlHasRMCtrlFD[nvgpu.UVM_REGISTER_GPU_PARAMS],
nvgpu.UVM_UNREGISTER_GPU: uvmIoctlSimple[nvgpu.UVM_UNREGISTER_GPU_PARAMS],
nvgpu.UVM_PAGEABLE_MEM_ACCESS: uvmIoctlSimple[nvgpu.UVM_PAGEABLE_MEM_ACCESS_PARAMS],
nvgpu.UVM_SET_PREFERRED_LOCATION: uvmIoctlSimple[nvgpu.UVM_SET_PREFERRED_LOCATION_PARAMS],
nvgpu.UVM_DISABLE_READ_DUPLICATION: uvmIoctlSimple[nvgpu.UVM_DISABLE_READ_DUPLICATION_PARAMS],
nvgpu.UVM_MAP_DYNAMIC_PARALLELISM_REGION: uvmIoctlSimple[nvgpu.UVM_MAP_DYNAMIC_PARALLELISM_REGION_PARAMS],
nvgpu.UVM_ALLOC_SEMAPHORE_POOL: uvmIoctlSimple[nvgpu.UVM_ALLOC_SEMAPHORE_POOL_PARAMS],
Expand Down

0 comments on commit 9af5108

Please sign in to comment.