Skip to content

Commit

Permalink
Consistently use "handler is undefined" for missing handlers.
Browse files Browse the repository at this point in the history
nvproxy additionally branches at the following points which are not covered by
the ABI struct:
1. Frontend ioctl NV_ESC_RM_ALLOC_MEMORY on
   nv_ioctl_nvos02_parameters_with_fd::params::hClass.
2. Frontend ioctl NV_ESC_RM_VID_HEAP_CONTROL on NVOS32_PARAMETERS::function.

In case nvproxy doesn't implement one of the values, it should print a warning
with the same prefix of "handler is undefined" which is used for other branch
points. This will make it easier to grep for missing nvproxy functionality.

Also update documentation for nvproxy debugging. Earlier, nvproxy logged
"nvproxy: unknown ..." for such situations. That changed with 6953ca0
("Add NVIDIA driver capability segmentation support to nvproxy."), which moved
to using "nvproxy: handler is undefined ...".

PiperOrigin-RevId: 726565029
  • Loading branch information
ayushr2 authored and gvisor-bot committed Feb 13, 2025
1 parent dd8ea25 commit 5457cf6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions g3doc/user_guide/gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ Please
[open a GitHub issue](https://github.com/google/gvisor/issues/new?labels=type%3A+bug,area%3A+gpu&template=bug_report.yml)
to describe about your use case. If a missing `ioctl` implementation is the
problem, then the [debug logs](/docs/user_guide/debugging/) will contain
warnings with prefix `nvproxy: unknown *`. See below on how to run the
`ioctl_sniffer` tool.
warnings with prefix `nvproxy: handler is undefined *`. See below on how to run
the `ioctl_sniffer` tool.

### Debugging

Expand Down
4 changes: 2 additions & 2 deletions pkg/sentry/devices/nvproxy/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func rmAllocMemory(fi *frontendIoctlState) (uintptr, error) {
case nvgpu.NV01_MEMORY_SYSTEM_OS_DESCRIPTOR:
return rmAllocOSDescriptor(fi, &ioctlParams)
default:
fi.ctx.Warningf("nvproxy: unknown NV_ESC_RM_ALLOC_MEMORY class %v", ioctlParams.Params.HClass)
fi.ctx.Warningf("nvproxy: %s for NV_ESC_RM_ALLOC_MEMORY class %v", errUndefinedHandler.Error(), ioctlParams.Params.HClass)
return 0, linuxerr.EINVAL
}
}
Expand Down Expand Up @@ -1305,7 +1305,7 @@ func rmVidHeapControl(fi *frontendIoctlState) (uintptr, error) {
case nvgpu.NVOS32_FUNCTION_ALLOC_SIZE:
return rmVidHeapControlAllocSize(fi, &ioctlParams)
default:
fi.ctx.Warningf("nvproxy: unknown VID_HEAP_CONTROL function %d", ioctlParams.Function)
fi.ctx.Warningf("nvproxy: %s for VID_HEAP_CONTROL function %d", errUndefinedHandler.Error(), ioctlParams.Function)
return 0, linuxerr.EINVAL
}
}
Expand Down

0 comments on commit 5457cf6

Please sign in to comment.