Skip to content

Commit 4e9165c

Browse files
ayushr2gvisor-bot
authored andcommitted
nvproxy: Add support for UVM_ENABLE_READ_DUPLICATION and UVM_SET_ACCESSED_BY.
Verified that the following reproducer works: ``` docker run --runtime=runsc --gpus all --rm \ nvidia/cuda:12.4.1-devel-ubuntu22.04 \ bash -c "apt-get update && apt-get install -y python3 python3-pip && \ pip install 'mlx[cuda]==0.27.1' 'mlx-lm==0.26.3' && \ python3 -c 'import mlx_lm; print(\"Import Successful\")'" ``` Support for UVM_ENABLE_READ_DUPLICATION was sufficient to satisfy the reproducer. Support for UVM_SET_ACCESSED_BY was added because `TestCUDA/Samples/4_CUDA_Libraries/conjugateGradientMultiDeviceCG` was failing without it. Fixes #12034 PiperOrigin-RevId: 852757609
1 parent 534579b commit 4e9165c

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

pkg/abi/nvgpu/uvm.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ const (
3737
UVM_PAGEABLE_MEM_ACCESS = 39
3838
UVM_SET_PREFERRED_LOCATION = 42
3939
UVM_UNSET_PREFERRED_LOCATION = 43
40+
UVM_ENABLE_READ_DUPLICATION = 44
4041
UVM_DISABLE_READ_DUPLICATION = 45
42+
UVM_SET_ACCESSED_BY = 46
4143
UVM_UNSET_ACCESSED_BY = 47
4244
UVM_MIGRATE = 51
4345
UVM_MIGRATE_RANGE_GROUP = 53
@@ -462,6 +464,24 @@ func (p *UVM_UNSET_PREFERRED_LOCATION_PARAMS) SetStatus(status uint32) {
462464
p.RMStatus = status
463465
}
464466

467+
// +marshal
468+
type UVM_ENABLE_READ_DUPLICATION_PARAMS struct {
469+
RequestedBase uint64
470+
Length uint64
471+
RMStatus uint32
472+
Pad0 [4]byte
473+
}
474+
475+
// GetStatus implements HasStatus.GetStatus.
476+
func (p *UVM_ENABLE_READ_DUPLICATION_PARAMS) GetStatus() uint32 {
477+
return p.RMStatus
478+
}
479+
480+
// SetStatus implements HasStatus.SetStatus.
481+
func (p *UVM_ENABLE_READ_DUPLICATION_PARAMS) SetStatus(status uint32) {
482+
p.RMStatus = status
483+
}
484+
465485
// +marshal
466486
type UVM_DISABLE_READ_DUPLICATION_PARAMS struct {
467487
RequestedBase uint64
@@ -480,6 +500,25 @@ func (p *UVM_DISABLE_READ_DUPLICATION_PARAMS) SetStatus(status uint32) {
480500
p.RMStatus = status
481501
}
482502

503+
// +marshal
504+
type UVM_SET_ACCESSED_BY_PARAMS struct {
505+
RequestedBase uint64
506+
Length uint64
507+
AccessedByUUID NvUUID
508+
RMStatus uint32
509+
Pad0 [4]byte
510+
}
511+
512+
// GetStatus implements HasStatus.GetStatus.
513+
func (p *UVM_SET_ACCESSED_BY_PARAMS) GetStatus() uint32 {
514+
return p.RMStatus
515+
}
516+
517+
// SetStatus implements HasStatus.SetStatus.
518+
func (p *UVM_SET_ACCESSED_BY_PARAMS) SetStatus(status uint32) {
519+
p.RMStatus = status
520+
}
521+
483522
// +marshal
484523
type UVM_UNSET_ACCESSED_BY_PARAMS struct {
485524
RequestedBase uint64

pkg/sentry/devices/nvproxy/seccomp_filters.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ func uvmIoctlFilters(enabledCaps nvconf.DriverCaps) []seccomp.SyscallRule {
9999
{seccomp.EqualTo(nvgpu.UVM_PAGEABLE_MEM_ACCESS), compUtil},
100100
{seccomp.EqualTo(nvgpu.UVM_SET_PREFERRED_LOCATION), compUtil},
101101
{seccomp.EqualTo(nvgpu.UVM_UNSET_PREFERRED_LOCATION), compUtil},
102+
{seccomp.EqualTo(nvgpu.UVM_ENABLE_READ_DUPLICATION), compUtil},
102103
{seccomp.EqualTo(nvgpu.UVM_DISABLE_READ_DUPLICATION), compUtil},
104+
{seccomp.EqualTo(nvgpu.UVM_SET_ACCESSED_BY), compUtil},
103105
{seccomp.EqualTo(nvgpu.UVM_UNSET_ACCESSED_BY), compUtil},
104106
{seccomp.EqualTo(nvgpu.UVM_MIGRATE), compUtil},
105107
{seccomp.EqualTo(nvgpu.UVM_MIGRATE_RANGE_GROUP), compUtil},

pkg/sentry/devices/nvproxy/version.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ func Init() {
208208
nvgpu.UVM_PAGEABLE_MEM_ACCESS: uvmHandler(uvmIoctlSimple[nvgpu.UVM_PAGEABLE_MEM_ACCESS_PARAMS], compUtil),
209209
nvgpu.UVM_SET_PREFERRED_LOCATION: uvmHandler(uvmIoctlSimple[nvgpu.UVM_SET_PREFERRED_LOCATION_PARAMS], compUtil),
210210
nvgpu.UVM_UNSET_PREFERRED_LOCATION: uvmHandler(uvmIoctlSimple[nvgpu.UVM_UNSET_PREFERRED_LOCATION_PARAMS], compUtil),
211+
nvgpu.UVM_ENABLE_READ_DUPLICATION: uvmHandler(uvmIoctlSimple[nvgpu.UVM_ENABLE_READ_DUPLICATION_PARAMS], compUtil),
211212
nvgpu.UVM_DISABLE_READ_DUPLICATION: uvmHandler(uvmIoctlSimple[nvgpu.UVM_DISABLE_READ_DUPLICATION_PARAMS], compUtil),
213+
nvgpu.UVM_SET_ACCESSED_BY: uvmHandler(uvmIoctlSimple[nvgpu.UVM_SET_ACCESSED_BY_PARAMS], compUtil),
212214
nvgpu.UVM_UNSET_ACCESSED_BY: uvmHandler(uvmIoctlSimple[nvgpu.UVM_UNSET_ACCESSED_BY_PARAMS], compUtil),
213215
nvgpu.UVM_MIGRATE: uvmHandler(uvmIoctlSimple[nvgpu.UVM_MIGRATE_PARAMS], compUtil),
214216
nvgpu.UVM_MIGRATE_RANGE_GROUP: uvmHandler(uvmIoctlSimple[nvgpu.UVM_MIGRATE_RANGE_GROUP_PARAMS], compUtil),
@@ -475,7 +477,9 @@ func Init() {
475477
nvgpu.UVM_PAGEABLE_MEM_ACCESS: ioctlInfo("UVM_PAGEABLE_MEM_ACCESS", nvgpu.UVM_PAGEABLE_MEM_ACCESS_PARAMS{}),
476478
nvgpu.UVM_SET_PREFERRED_LOCATION: ioctlInfo("UVM_SET_PREFERRED_LOCATION", nvgpu.UVM_SET_PREFERRED_LOCATION_PARAMS{}),
477479
nvgpu.UVM_UNSET_PREFERRED_LOCATION: ioctlInfo("UVM_UNSET_PREFERRED_LOCATION", nvgpu.UVM_UNSET_PREFERRED_LOCATION_PARAMS{}),
480+
nvgpu.UVM_ENABLE_READ_DUPLICATION: ioctlInfo("UVM_ENABLE_READ_DUPLICATION", nvgpu.UVM_ENABLE_READ_DUPLICATION_PARAMS{}),
478481
nvgpu.UVM_DISABLE_READ_DUPLICATION: ioctlInfo("UVM_DISABLE_READ_DUPLICATION", nvgpu.UVM_DISABLE_READ_DUPLICATION_PARAMS{}),
482+
nvgpu.UVM_SET_ACCESSED_BY: ioctlInfo("UVM_SET_ACCESSED_BY", nvgpu.UVM_SET_ACCESSED_BY_PARAMS{}),
479483
nvgpu.UVM_UNSET_ACCESSED_BY: ioctlInfo("UVM_UNSET_ACCESSED_BY", nvgpu.UVM_UNSET_ACCESSED_BY_PARAMS{}),
480484
nvgpu.UVM_MIGRATE: ioctlInfo("UVM_MIGRATE", nvgpu.UVM_MIGRATE_PARAMS{}),
481485
nvgpu.UVM_MIGRATE_RANGE_GROUP: ioctlInfo("UVM_MIGRATE_RANGE_GROUP", nvgpu.UVM_MIGRATE_RANGE_GROUP_PARAMS{}),

0 commit comments

Comments
 (0)