From 5457cf6def766ebe1997321cb3ec57772001b0cb Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Thu, 13 Feb 2025 11:17:33 -0800 Subject: [PATCH] Consistently use "handler is undefined" for missing handlers. 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 6953ca0ca351 ("Add NVIDIA driver capability segmentation support to nvproxy."), which moved to using "nvproxy: handler is undefined ...". PiperOrigin-RevId: 726565029 --- g3doc/user_guide/gpu.md | 4 ++-- pkg/sentry/devices/nvproxy/frontend.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/g3doc/user_guide/gpu.md b/g3doc/user_guide/gpu.md index 584a4a3a0..b0e3a5bfa 100644 --- a/g3doc/user_guide/gpu.md +++ b/g3doc/user_guide/gpu.md @@ -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 diff --git a/pkg/sentry/devices/nvproxy/frontend.go b/pkg/sentry/devices/nvproxy/frontend.go index 9e6a2d180..d1eb081b8 100644 --- a/pkg/sentry/devices/nvproxy/frontend.go +++ b/pkg/sentry/devices/nvproxy/frontend.go @@ -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 } } @@ -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 } }