Repository navigation
cuMemHostRegister does not scale across GPUs: UVM's external mapping takes the RM API lock and all GPU locks #1598
josephcrivello
started this conversation in
General
Replies: 1 comment
|
Attachments: all five files, including the two tar archives, are in this Gist. The SHA-256 values for all five files are in the report. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
cuMemHostRegister does not scale across GPUs: UVM's external mapping takes the RM API lock and all GPU locks
Summary
Concurrent cuMemHostRegister calls for different GPUs do not scale; we met this loading a large model onto eight GPUs. Instances A–D are AWS p6-b300.48xlarge KVM guests with eight NVIDIA B300 GPUs and no IOMMU groups. Rates are 256 MiB registrations/s. Ubuntu cells are three-run ranges except where marked.
With installer's 595.112.07 open modules on Ubuntu 24.04 (kernel 7.0.0-1018-aws), A's g1 sweep completes 218–222 at one process and 224–248 at eight, one per GPU; B completes 214–230 and 233–272. With 620.73.04, eight processes complete 272–280 on A and 269–286 on C.
UVM's external mapping takes the RM API lock and all GPU locks in the dup and PTE queries. Our test patch (595.112.07, ported to 620.73.04) takes only the mapping device's GPU lock for PTE queries of registered host memory and skips a repeated dup DMA range check. At eight, patched 595.112.07 completes 1,335 to 1,341 (2 runs) on B against stock 233 to 272; patched 620.73.04 completes 1,329 to 1,361 (2 runs) on C against 269 to 286.
With libcuda 615.71.10, stock eight-process rates were 372 to 431 on two kernel.org 6.18.63 instances with unmodified 595.112.07 modules built from the tag; the trace instance's separate libcuda 595.112.07 runs were 355.9 to 395.5. Kernel, build, library and instance were uncontrolled. Patched 6.18.63 results are in "Results in our workload".
The patch is a measurement aid. Do not merge it.
Disclosure
AI coding agents (Anthropic's Claude Code, using Fable 5.2 and Kimi K3.1 Pro) did the analysis and wrote the benchmark, test patch and report. Other AI agents reviewed the patch adversarially and re-read the driver source for "How the patch was checked". A person read the report and posted it.
Where the time goes
Citations are to 595.112.07; nv_gpu_ops.c is src/nvidia/src/kernel/rmapi/nv_gpu_ops.c. A registration is an RM ioctl that pins the pages, then a UVM external mapping (uvm_map_external_allocation(), kernel-open/nvidia-uvm/uvm_map_external.c:971-1081). Two of the mapping's steps take global locks:
Mechanism from one traced eight-process stock run on D (128 registrations; means):
Queries' GPU-lock waits lengthen API read holds; dup write holds and registration-ioctl read holds also contribute, without a total apportionment. A registration spends 18,304 microseconds in kernel, 14,458 (79%) in probed-lock waits: 55% GPU and 45% API.
On Ubuntu (B, three runs), median patched-module PTE queries take 76–78 microseconds at one process and 2,962–3,155 at eight with the patch off, and 66 and 82–83 with both changes on.
Results
For Ubuntu hostreg-bench (attached) on A, B and C, each process registers sixteen 256 MiB buffers on its GPU after MADV_HUGEPAGE; records report huge_mib=buffer_mib, a process-wide check that does not prove per-buffer layout; backing was not recorded for 68 uninstrumented kernel.org control/stock-range records. Registrations/s is registrations over common-start-to-last-registration time. Workers clean up after their last registration; cleanup and verification can overlap others', adding contention, not duration, to the denominator. Cells are three-run ranges except where marked otherwise, with 595.112.07 on Ubuntu 24.04 (kernel 7.0.0-1018-aws), on instances A and B; A's 595 cells are the g1 THP sweep. The patched module was built from the patched source with the repository's Makefile (
make modules).nvidia.ko's tts_locktest controls the patch (tts_ prefixes our test tooling and means nothing in the driver). At 0 on a fresh load with bit 0 never set, the module takes stock locks and makes stock calls. Returning to 0 after bit 0 was set restores stock locking but not every lookup. Values 1, 2 and 3 enable the PTE-query change, dup change and both.
--verifychecked one 64-bit pattern word per 4 KiB after each GPU round trip; every checked word in every buffer matched with stock (A) and patched tts_locktest=3 (B). This checks sampled data, not whole buffers or the copy path.At eight on B, the query change alone (tts_locktest=1) gives 860.5 to 885.7 and the dup change alone (2) 242.9 to 302.0. The gains are not additive: with only the query change, the dup still holds the API write lock and waits for readers; with only the dup change, queries still wait for all GPU locks.
On C at eight, the 620.73.04 port (tts_locktest=3) gives 1,328.9 to 1,361.1 (2 runs) against the installer's 268.8 to 285.9 ("Benchmark: environment and reported runs").
Three 6.18.63 cold-start pairs in our eight-GPU server workload compared tts_locktest=3 with 0 on one patched module, each member once on a fresh instance. Kernel-start-to-first-correct-answer times were 48.0–48.4 s with 0 and 40.0–40.2 with 3, paired differences 7.7–8.4 s across instances. These are non-reproducible context, not an isolated patch effect. Best-second rates for eight loaders were 413–422 with 0 and 1,053–1,076 with 3 ("Results in our workload").
The test patch
What it changes. tts_locktest is a bitmask. Bit 0 lets a PTE query take only the mapping device's GPU lock, instead of all GPU locks, for registered system memory of at least 64 MiB whose descriptor belongs to that owner GPU. Every other case and the exceptions below take the stock locks. "Test patch: what it does" has the full conditions.
The patch saves the owner GPU's IOMMU-mapping pointer at registration, clears it on unlink, and uses it instead of walking the list.
Bit 1 makes the dup skip the range check when the owner GPU's mapping already exists.
Why we think it holds, and what is not proven. During a one-lock query, the registration and the query's Memory object (UVM's own dup) hold references to the owner GPU's entry; the dup's release takes the session client lock in write mode, while the query holds that lock in read mode.
The count must be exact. The 30 name-only helper sites and profiler groups are unverified for registered-memory reachability and locking; other established sites hold the API write lock at default keys on a physical GPU on silicon, except:
This is source reading, not a proof.
How it was checked. A second AI agent reviewed the design and diff by reading; two further source readings found no counter-example. A DEBUG=1 build asserts the lifetime claim where the saved pointer is cleared; every build counts one-lock queries whose saved pointer changed. The assertion did not fire in 14 debug runs at each tag, and the counter stayed 0 in every run.
These zeros show only absence of false alarms here. Each process touched only its own GPU's registrations; no run caused the early unlink the checks target, and neither check was seen to fire. The counter also misses a query that faults first.
Nobody with first-hand knowledge of RM locking has reviewed the patch. We did not fuzz it or write a program to provoke a race. Open points: collapsed block "How the patch was checked".
What we ask
The driver's bug-report log is available on request. Attached:
---, the diff). sha256 of the file: 83253bf999a107a7afacc8dcb8a9274f13d6f26d2069750c1d8bf501afd11ab3. sha256 of its diff part, from the first--- a/line to the end of the file: 02abf7e1ead86ce38efd9b435f7e706e47065985c8cff5d55574c0eb5e365f15.Benchmark: environment and reported runs
The README describes the program/output. Runs used
--mem thp --timeout 150as root unless named otherwise; all exited 0. Rates are registrations/s; "ms per call" is mean cuMemHostRegister time.Environment
--silent --kernel-module-type=open --no-x-check --no-dkms --no-rebuild-initramfs; installer's libcuda (595.112.07: CUDA driver API 13.2; 620.73.04: CUDA driver API 13.5).RegistryDwords: "".Instance A ran the stock modules only. Instance B ran the installer's stock 595.112.07 module and then the patched builds, in one session. Instance C ran 620.73.04 only: the installer's module, our own build of the unmodified source and the ported patch.
Stock 595.112.07 (A's g1 sweep and B; three runs per cell; one where marked)
Auxiliary A runs outside g1 (ranges; separate loads):
--mem anon, two runs, one/eight: 135.0–139.4 / 260.0–268.8; g2.default (default keys), eight: 229.5–251.4; g2.nohmm (uvm_disable_hmm=Y), eight: 218.4–256.7; g3.off (default keys, lock-time control refused), one/eight: 217.3–221.8 / 239.0–264.7; g3.on (RmLockTimeCollect=1), one/eight: 213.5–216.1 / 216.8–254.7.--verify(instance A): 0 mismatches at one and at eight processes. One process copies 52.4 GiB/s through registered buffers against 11.3 GiB/s through an unregistered one. The README has the CPU time of the copies, which shows that the calling thread did not move the data of the registered buffers.Stock 620.73.04 (instance A, three runs per cell)
--verify: 0 mismatches at one/eight. Median eight-process rate 272.5 is 12% above 595.112.07's g1 value (243.4); means differ 15%. Driver effects are unseparated from a reboot and fabric manager 595.112.07 (NVIDIA's apt repository has none for 620.73.x).Patched 595.112.07 (instance B)
Built on B from GitHub's 595.112.07 archive (sha256 6bf8f19b9d7fa6ca0029100fe09f8a72d413df67e08ad4428b1b358ec10d28c0) with the six-file diff using gcc 13.3.0:
make modules, ormake modules DEBUG=1. nvidia.ko was loaded withinsmod nvidia.ko tts_locktest=<value>and nothing else; nvidia-uvm.ko kept the installer's srcversion. Counters are each run's tts_counts delta, identical within a row: (1) one-GPU-lock queries, (2) stock-lock retries, (3) dups skipping the check, (4) lock-helper errors, (5) missing-pointer retries, (6) non-default-mask retries, (7) bit-2-forced retries, (8) queries whose saved pointer changed.Timing cells. The first run in each tts_locktest=3 cell used --snapshot-file and is used only for counter attribution, not for timing; the two reported runs have no snapshot reads.
Switch-off control. With tts_locktest=0 the patched module's rates lie at or below the installer's on instance B: 212 to 214 against 214 to 230 at one process, and 220 to 238 against 233 to 272 at eight. The mean deficits are 3.86% at one process and 9.22% at eight. No counter moves. We built no unmodified module on B. The smaller deficits of C's unmodified build are consistent with a compile effect, but B lacks the control needed to separate compile and patch costs.
Six queries per buffer. Sixteen 256 MiB buffers give 96 queries under the device's GPU lock, six each. The 31 retried queries and 4 of the 20 dups per process are made outside the registrations: between the benchmark's counter snapshots before and after the sixteen registrations of a one-process run the counters moved by 96 0 16 0 0 0 0 0.
Forced fallback (tts_locktest=7). Every eligible query went back to the stock locks: counter 7 rose by exactly the number of one-lock queries seen at 3, and counter 1 did not move. At one process, 238.3 to 239.6 is 1.4 to 1.9% above the sole tts_locktest=2 run, 235.1; one control cannot establish overlap. At eight the ranges overlap, 204.4 to 251.0 against 242.9 to 302.0, so no release-and-retry cost shows above that spread there.
--verifywith tts_locktest=3: 238.5 at one process and 1,330.0 at eight; with--sched blocking238.6 and 1,331.6; with tts_locktest=7 at eight processes 299.6. 0 mismatches in all five. In these runs each process makes one more retried query than in a plain run (counter 2 reads 32 instead of 31 at one process). We did not identify the mapping that causes it.Counter 8 was 0 in every run of every row. So were counters 4, 5 and 6: the fallbacks for a lock helper error, for a missing saved pointer and for a non-default lock mask never ran.
620.73.04, stock and ported patch (instance C)
A third instance of the same type and image, as in "Environment" except: 620.73.04 was installed on the fresh image, with no other driver before it, and bound all eight GPUs at once. The fabric manager under it is again nvidia-fabricmanager 595.112.07-1ubuntu1 (NVIDIA's apt repository has none for 620.73.x); all eight GPUs read "Completed" after every module load.
Both builds use GitHub's 620.73.04 archive (sha256 1397e8eff72bbaff1c2edd7a07fb7454912f2bb5629c2b047add3b7ed43bbac9) and gcc 13.3.0: "own build, unmodified" is
make modulesof pristine source; "patched" applies the six-file port (no fuzz/offset) before the same build. Own-unmodified loaded pristine nvidia.ko with installer's nvidia_modeset.ko, nvidia_drm.ko and nvidia_uvm.ko; patched arms insmod all four from the build tree. Support-file hashes are unrecorded; matching UVM srcversion is not byte identity. Counters are as for 595.112.07.Probes on UVM's calls into RM (T group): each row is one run without probes and three with, 16 non-DEBUG runs in all. Times are microseconds per call.
--verifywith tts_locktest=3: 234.1 at one process and 1,292.1 at eight; with--sched blocking236.5 and 1,339.3; with tts_locktest=7 at eight processes 292.1. 0 mismatches in all five. As at 595.112.07, each process makes one more retried query in these runs.Where the time goes: traces and lock-time counters
1. Kernel probes on the RM core (kernel.org 6.18.63, stock 595.112.07, one run per process count)
Ubuntu's 7.0.0-1018-aws kernel refuses RM-core kprobes, including in the installer's nvidia.ko ("Could not probe notrace function"). Per-lock figures therefore use instance D, of the same type but running kernel.org Linux 6.18.63 and stock 595.112.07 modules built from the tag. With libcuda 615.71.10, uninstrumented benchmark rates there are 251.3 to 262.3 at one process and 372 to 428 at eight (372 to 431 with a second such instance); the traced one-process run gave 251.1 registrations/s. The trace instance's separate libcuda 595.112.07 runs were 355.9 to 395.5 at eight. The 33 kprobe/kretprobe events include os_lock_user_pages, RmIoctl, nvUvmInterfaceDupMemory, memdescMapIommu, nvUvmInterfaceGetExternalAllocPtes, uvm_api_map_external_allocation, rmapiLockAcquire, rmGpuGroupLockAcquire, rmGpuLocksAcquire and kernel lock slow paths. No event was lost; every entry/return pair is complete. The traced eight-process run gave 384.2 registrations/s.
Instance D and the second comparison instance shared one kernel configuration (GCC 16.2.0, GNU ld 2.46) and Fabric Manager 595.112.07. Instance D's traced runs used libcuda 615.71.10/API 13.4. On the second instance, three eight-process runs with libcuda 595.112.07/API 13.2 gave 419.8, 426.7 and 405.5 registrations/s (405.5 to 426.7); the 615-library runs for both instances are tabulated in hostreg-lock-evidence.tar.gz, with the complete configurations and build recipes.
Figures are means in microseconds over each process's sixteen 256 MiB registrations (16 at one process, 128 at eight). A registration is the page-pinning RM ioctl plus the same thread's UVM mapping call. Each of the 144 registrations has six PTE queries.
The wait in lock acquisitions, by lock, with the mean number of acquisitions per registration that slept at eight processes:
Counts cover only acquisitions that returned in the 333 ms window, not all that began in it. The table covers the 128 timed registrations. With no release probe, a hold runs from acquisition return to the enclosing return.
Why the gains are not additive. The dup's 559.5 to 595.3 microsecond API-write hold alone would allow 1,680 to 1,787 registrations/s, not the 861 to 886 measured with only the query change on Ubuntu (B). The hold plus the writer's wait for readers can explain it: those readers include each registration's RM ioctl, whose API-read hold is 1,537 at one process. No single-change run was traced, so this is explanation, not measurement.
Limits: one run per process count. In the eight-process run, lock-wait share is 76.9 to 81.2% across processes; across its 128 registrations the median is 78.5% and range 61.2 to 91.7%. The processes wait for each other, so this spread does not show run-to-run variation.
2. Probes on UVM's calls into RM (Ubuntu, instance B, patched release build, three runs each)
The probe file has 35 probes (instrument 1 had 33); Ubuntu accepted 17: entry/return on the pin, UVM map, dup, PTE query and four kernel lock slow paths, plus one on UVM's dup. Only the PTE-query and dup mean/median columns are microseconds per call. Each process makes 127 PTE queries and 45 dups across CUDA context creation and registrations; counter 3 covers only the 20 dups that skipped the check.
With the patch at eight processes the median query takes 82 to 83, but the mean is about 1,000: within the five displayed lock addresses, 542 to 564 slow-path waits occur inside PTE queries, split into 524 to 543 API-read waits and 9 to 27 GPU-semaphore waits. These are not whole-run totals.
3. RM's lock-time counters and the kernel's slow paths on the same runs (Ubuntu, stock 595.112.07)
The stock module was loaded with NVreg_RegistryDwords="RmLockTimeCollect=1" (read back). RM counters were read through NV0000_CTRL_CMD_SYSTEM_GET_LOCK_TIMES around each run, with the 17 probes active (instance B). Both instruments sum over all processes and whole runs, including CUDA initialization/context creation, not just the 128 timed calls (about 3.6 s in total per run).
The instruments agree within 0.05 s and show large whole-run API-lock contention, but not its timed-registration share: of about 8,100 write-side and 6,800 read-side API-lock waits per run, about 340 were in a dup and 740 to 820 in a PTE query. Only instrument 1 splits a registration's wait between API and GPU locks.
Test patch: what it does
Summary of the attached 595.112.07 patch (
patch -p1, six files): two os-interface.h copies and kernel-open/nvidia/os-interface.c add NV_API_CALL os_tts_locktest_flags()/os_tts_locktest_count() to expose the parameter/counters; generated g_mem_desc_nvoc.h adds the descriptor-enlarging field; mem_desc.c and nv_gpu_ops.c change. nvidia.ko's tts_locktest (bitmask, default 0, runtime-writable, read once per call) and tts_counts (read-only eight counters above) are scaffolding, not a proposed interface.Bit 0 (value 1). A PTE query takes the mapping device's GPU lock through the stock helper, with stock API/client modes, lookups and errors. It continues under that lock only if all conditions below hold; otherwise it releases, takes all GPU locks and repeats the lookups. Lock-helper failure also takes all GPU locks.
The saved pointer. With bit 0 set, memdescAddIommuMap() stores it when linking an owner-GPU IOVA-space entry to a root descriptor with MEMDESC_FLAGS_EXT_PAGE_ARRAY_MEM and without MEMDESC_FLAGS_SKIP_IOMMU_MAPPING. For a descriptor visible to a query, memdescRemoveIommuMap() clears the pointer on unlink regardless of the parameter. memdescGetIommuMap() returns it for that IOVA space without touching the list head or another entry. It is also reset during forced mapping destruction (mem_desc.c:542-563). A later range-check refusal is possible if the DMA limit changes; known post-registration callers other than runtime D3 hold the API write lock, while runtime D3 is excluded only if its entry-point GPU locks are retained throughout, which was not verified (:4329-4360). Memory registered with bit 0 clear has no pointer and takes all GPU locks (counter 5); set the parameter first.
Bit 1 (value 2). dupMemory()'s new helper calls iovaspaceAcquireMapping() and skips the range check when the descriptor is the mapping GPU's own ADDR_SYSMEM with MEMDESC_FLAGS_EXT_PAGE_ARRAY_MEM, is not submemory, lacks MEMDESC_FLAGS_SKIP_IOMMU_MAPPING and already has a mapping in that IOVA space; otherwise it calls memdescMapIommu(). Locks are unchanged, with no size limit.
Bit 2 (value 4) is a test aid: with bit 0 set, a query that passed every other test is sent to the stock locks.
With tts_locktest at 0 and never set since module load, stock lock acquisitions and calls retain their order; no lock is added and no differing shared-memory value is stored. The patch's description lists the few reads, compares, branches and stores of NULL that execute in addition.
Scope. Bit 0 admits registered user pages and dma-bufs/scatterlists imported as OS descriptors (osmemdesc.c:765, flag :863), which its tests cannot distinguish from user pages. Physical-address registrations are contiguous and excluded. We exercised user pages only. The 64 MiB limit is ours, keeping small buffers on the stock path, not a driver property.
The 595.112.07 patch does not apply to 620.73.04 (7 of 19 hunks fail). There the descriptor's mappings are an intrusive mem_desc.c list, appended at the tail and unlinked through one function; the query gets its descriptor from rmresGetMemInterMapParams() (nv_gpu_ops.c:4795-4801). The port keeps the tests, counters and parameters, but moves the pointer store/clear/shortcut into three static list functions, needs no forced-destroy reset, adds one mem_desc.c function for bit 1, also asks memmgrIsFlaSysmemSupported_HAL() for each attached GPU, and falls back for MEMDESC_FLAGS_SKIP_IOMMU_MAPPING or a different descriptor from rmresGetMemInterMapParams(). It was reviewed and run on instance C, whose DEBUG=1 build "Benchmark: environment and reported runs" describes.
How the patch was checked
Readings are of 595.112.07 at default keys unless another tag/key is named. GPU A owns the registration; "the one-lock query" is the patched PTE query holding the API read lock, UVM's session client lock and A's GPU lock.
The lifetime argument
For a descriptor visible to a query, the owner's entry can be unlinked when its reference count reaches zero, on descriptor destruction, or by a DMA range-check refusal. A post-registration refusal is excluded only under the caller-lock qualifications above, including unverified runtime D3. Two holders keep it:
A free under another GPU's lock can lower the count. Example: a dup under B is RM-mapped into A's VA space and freed, holding the API read lock, its client's lock and B's GPU lock alone. With both holders present and an exact count, that cannot reach zero. The count is a plain integer: an increment outside the API write lock concurrent with such a decrement could leave it too low. The readings below test exactness.
The adversarial review
The attached patches are the second revision; original measured diff parts and normalized comparison under
provenance/show only comments and one hunk-length field changed, not code lines. Hashes are in ubuntu595/home/src.txt, ubuntu620/home/src.txt andprovenance/. Every patched figure used that code. The first revision has a race found by reading and not reproduced; this revision is meant to close it.Two other AI agents, which did not write the patch and were told to break it, reviewed it by reading and ran nothing: one the design and the diff part of the attached patch for 595.112.07, the other the diff part of the attached port to 620.73.04. The verdict of each was "NOT BROKEN BY WHAT I TRIED".
Findings of the review and of reading 1 below that led to changes:
Two of the review's points are open:
The port review found no counterexample to the lifetime argument, subject to the unread paths below. Not every reading was repeated:
Reading 1: every site that raises an entry's count
Two lines increment a count (src/nvidia/src/kernel/mem_mgr/io_vaspace.c:495, the acquire of an existing entry, and :520, a temporary increment by the destroying thread). The acquire has two callers, memdescMapIommu() (11 call sites) and the creation of a sub-mapping, reached from memdescCreateSubMem() (21 call sites). For the sites below, the reading established registered-memory reachability and caller locks; the 30 helper sites classified only by name remain unverified.
Reading 2: what else can run beside the one-lock query
The question was whether any thread that the stock all-GPU lock excludes, and A's lock does not, writes a field the query reads, or frees or unlinks an object it uses. None was found. What was covered, and how:
Limits of this reading: handlers were classified by flags, by name and by a call graph that does not follow function pointers; most handler bodies and all firmware handlers were not read. The lock of the 1 Hz timer callback, the firmware events drained during an RPC wait, the one control that takes no API lock, and system suspend and resume were not followed.
Tests
--verifyat one/eight (0 mismatches);--gpus 0;--mem anon;--size-mib 32 --buffers 128(all queries below the limit: 0 1272 1056 0 0 0 0 0);--unregister --rounds 3(2304 248 416 0 0 0 0 0); and 7 with/without--verify. Each added 16 or 17 kernel lines without assert, BUG, WARNING, Call Trace, Xid or "failed". Boot-to-end has none of the first five and 19 "failed" lines: 16 requests at two debug loads for unshipped GSP log firmware, 2 regulatory.db, and 1 unsigned-module notice at the installer's first stock load, before ours. The port ran the same 14 on C with no assertion.Not done
Source readings: newer tags, the range check, registry keys
Source reading only, unless a measurement is cited. Paths are under src/nvidia/src/kernel/ unless they begin with src/ or kernel-open/; lines are 595.112.07's unless a tag is named.
Newer tags
Eight tags follow 595.112.07 (610.43.02, 610.43.03, 610.57.04, 615.71.09, 615.71.10, 615.78.08, 620.70.06, 620.73.04). We read the two steps' lock lines at all of them. 610.43.03 and 615.71.10 fit between their neighbours: the query asks for the API lock in read mode, forced, and all GPU locks; the dup for the API lock in write mode, both clients' locks and all GPU locks. The lock helpers' bodies were not re-read at these two tags.
The repeated range check
Six queries per buffer
UVM reads an external mapping's PTEs through a buffer of at most 96 KiB (kernel-open/nvidia-uvm/uvm_map_external.c:89, :118, :133-208): map_rm_pt_range() walks the range one page table at a time (:308-321) and calls RM only when the piece lies outside the buffer (:187-191). A PTE of a 4 KiB page is 8 bytes (kernel-open/nvidia-uvm/uvm_mmu.h:681-684), so one query returns at most 12,288 PTEs, 48 MiB: six queries for 256 MiB (five of 48 MiB and one of 16 MiB). With 2 MiB PTEs each of these sizes would take one query; that RM reports 4 KiB pages for this memory is inferred from the measured six, not read.
Registry keys and module parameters
Findings in the stock driver
Neither is caused or repaired by the test patch. The first is from source reading alone; the second was also met in a build.
make modules -j192 DEBUG=1; aftermake clean,make modules -j192exited 0 with the installer's srcversion.Results in our workload
Our loader starts an inference server for a large model on eight GPUs. Eight loader processes, one per GPU, register 256 MiB host buffers with cuMemHostRegister and copy each buffer to its GPU. We compared three pairs of cold starts on six newly launched, single-use AWS p6-b300.48xlarge spot instances (eight NVIDIA B300 GPUs) in us-west-2. All six ran the same custom image with open modules 595.112.07 built with the diff part of the attached test patch. Its recipe and kernel command line differ from the stock-tracing image. Its third out-of-tree module, tts_noclear, skips clearing explicitly registered 2 MiB anonymous-page ranges; MOVER_PAGES_NOCLEAR=1 enabled it in all six cold starts, and the machine-image benchmark has endpoint inactivity evidence only. Its source and activity records are attached. GPU_LOCKTEST was requested as 3 or 0 with otherwise constant image/configuration; counters corroborate the paths, but no timestamped pre-registration read-back was retained. Pair members ran on different fresh instances, so instance variation is an uncontrolled difference.
Each run made 6,663 model-data registrations of 256 MiB (1,665.75 GiB total) with libcuda 615.71.10 (API 13.4); Fabric Manager was 595.112.07. The server was vLLM's OpenAI-compatible server. Its installed source revision was not established: the recipe's vLLM pin was not verified against the six installations and so cannot identify what ran. These workload timings are therefore non-reproducible context. A temperature-0 POST /v1/messages asked for one add tool call for 17 and 25. It passed only with HTTP 200, a well-formed SSE stream, exactly one add tool_use with JSON {"a":17,"b":25} and stop_reason tool_use. Timing ends at the last byte of the first passing response on the node's CLOCK_BOOTTIME; kernel start is wall clock minus uptime, so launcher offset cancels.
Seconds from the instance's kernel start to the server's first correct answer:
The last byte of the model's data arrives at about the same second with both values (31.5 to 32.5 s after the kernel start with 3, 31.5 to 31.9 s with 0); the copies to the GPUs end 3.8 to 4.7 s after it with 3 and 13.0 to 13.6 s after it with 0. In the best second the eight processes together complete 1,053 to 1,076 registrations with 3 and 413 to 422 with 0. Each loader process issues its registrations from a pool of 32 threads on one CUDA context, so up to 32 calls of a process, 256 on the instance, are in flight at once; in the benchmark it is one call per process. We therefore give rates and no time per call.
At the end of each cold start tts_counts (counters as in the block "Benchmark: environment and reported runs") read 40002 23816 6863 0 0 0 0 0 with 3, the same in all three, and eight times 0 with 0; counter 8 stayed 0 in all six.
We also built and correctness-tested a copy path through 16 reusable registered 256 MiB buffers per process: the custom-storage restore calls returned at uptime 19.9 to 25.6 s in these eight register-in-place records (the six paired cold starts plus the additional reuse-early and reuse-second register-in-place measurements), 11.9 to 18.0 s after their own arrival began; per-second counters bound 34.48 to 57.80% of each record's eventual arrived bytes as already host-resident at that event. cuCheckpointProcessRestore gives the GPU addresses only on return. It is registered in place or copied again. That copy was filled by memcpy: 106.8 s from launch to first correct answer, against 102.0 s for registering every buffer in place. That is one cold start of each design on a different fresh instance with kernel module 595.112.07; the build identity was not recorded. Instance and configuration differences are uncontrolled, including MOVER_THREADS=128, GPU_S3_HOLD=ring versus registered, MOVER_REG_AHEAD=7 and MOVER_REG_WAIT=30. Run identity, module/libcuda and tts_locktest state were not retained for these 21 size/flag calls, so they are unconfigured observations, not evidence of a size or flag effect. The observed ranges were 104.2 to 110.1 ms/GiB at 256 MiB, 102.0 to 104.7 at 1 GiB and 110.6 to 111.8 at 8 GiB. Six flag combinations—none, PORTABLE, DEVICEMAP, PORTABLE + DEVICEMAP, READ_ONLY and PORTABLE + READ_ONLY—were called once each at 256 MiB and at 1 GiB (six calls per size). At 8 GiB there were nine calls: those six plus a second call each for none, PORTABLE and DEVICEMAP.
The benchmark times sixteen buffer registrations per process with no other work; here each buffer is registered once while model-data reads and GPU copies also run.
The two also ran on different kernels: the table in "Results" is from Ubuntu's 7.0.0-1018-aws, and the cold starts ran on our machine image's Linux 6.18.63. On Ubuntu with libcuda 595.112.07/API 13.2, the stock-lock eight-process benchmark rates are 224 to 248 (instance A, g1) and 233 to 272 (instance B); with libcuda 615.71.10/API 13.4, they are 372 to 431 on two kernel.org 6.18.63 instances; the trace instance's separate libcuda 595.112.07 runs were 355.9 to 395.5 at eight. Kernel, module build, libcuda and instance were not independently controlled, so the latter range is context for the cold starts' 413 to 422 at tts_locktest=0, not a controlled comparison.
On this machine image, with the image's libcuda 595.112.07 and eight processes, the patched module gives 360.7 to 387.8 registrations/s at tts_locktest=0 and 2,092.9 to 2,098.0 at tts_locktest=3 (three runs each). For these runs tts_noclear was loaded but its device refcount was 0 before and after the series; endpoint checks showed no compute processes or GPU memory in use before and after the series. tts_locktest was reset to 0 between runs, so the 0 measurements are not fresh-load controls. Only benchmark prefix d561153bbf50 and 52,608 bytes were retained; its full executable hash and compiler identity are unrecorded, so its source link is unestablished.
All reactions