diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-28 13:14:16 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-28 13:14:16 -0400 |
| commit | 6ac574eb67b478cb48ddfbd6e77f4613698020c7 (patch) | |
| tree | baa35d14574b0994312284ad077733f740f04cca /tools/test | |
| parent | 96ea661afff1c904ba46cb7e669f94f58453636f (diff) | |
| download | open-iov-6ac574eb67b478cb48ddfbd6e77f4613698020c7.tar.gz open-iov-6ac574eb67b478cb48ddfbd6e77f4613698020c7.zip | |
guest-diag: adaptive miss-driven pinner; cdt holds on failure for inspection
pin_miss_pages.sh watches the host journal for release-miss VAs, resolves
each page for the live cdt pid through the guest pagemap and injects it (the
injection rewinds the pump so releases consumed under a stale pin are
re-read); it re-pins when a new cdt pid appears. cuda_drv_test prints
cuGetErrorName/String on failure and, with CDT_HOLD=<seconds>, stays alive so
the RM error record and tracker state can be inspected after cuCtxCreate has
given up.
Diffstat (limited to 'tools/test')
| -rw-r--r-- | tools/test/cuda_drv_test.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tools/test/cuda_drv_test.c b/tools/test/cuda_drv_test.c index 20ad88a..8995a55 100644 --- a/tools/test/cuda_drv_test.c +++ b/tools/test/cuda_drv_test.c @@ -15,7 +15,9 @@ * gcc -O1 -o /tmp/cdt cuda_drv_test.c -ldl */ #include <stdio.h> +#include <stdlib.h> #include <string.h> +#include <unistd.h> #include <dlfcn.h> #include <stdint.h> @@ -24,9 +26,30 @@ typedef int CUdevice; typedef void *CUcontext; typedef uint64_t CUdeviceptr; +/* On failure: print cuGetErrorName/String and, when CDT_HOLD=<seconds> is + * set, keep the process alive so the live state (trackers, RM error record) + * can be inspected with gdb after cuCtxCreate has given up. */ +static void fail_info(CUresult r) +{ + const char *(*errname)(CUresult, const char **) = dlsym(RTLD_DEFAULT, "cuGetErrorName"); + const char *(*errstr)(CUresult, const char **) = dlsym(RTLD_DEFAULT, "cuGetErrorString"); + const char *s = NULL; + const char *hold = getenv("CDT_HOLD"); + + if (errname && errname(r, &s) == 0 && s) + printf("cuGetErrorName: %s\n", s); + if (errstr && errstr(r, &s) == 0 && s) + printf("cuGetErrorString: %s\n", s); + if (hold && atoi(hold) > 0) { + printf("CDT_HOLD: sleeping %d s for inspection\n", atoi(hold)); + fflush(stdout); + sleep((unsigned)atoi(hold)); + } +} + #define CHECK(expr) do { \ CUresult r = (expr); \ - if (r) { printf("%-24s FAILED rc=%d\n", #expr, r); return 1; } \ + if (r) { printf("%-24s FAILED rc=%d\n", #expr, r); fail_info(r); return 1; } \ printf("%-24s OK\n", #expr); \ } while (0) |
