- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime - Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after) - Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
64 KiB
RM API memory mapping notes (580.178.04, GV100): RM_MAP_MEMORY, mmap contexts, mmap, BAR1
Study-only notes for the memory slice and for the "BAR1 bring-up level". No hardware was touched. All sections are complete as of 2026-11-19; what could not be established is listed under "Open questions".
Evidence labels (BRIEF.md): [A] instructions read (REA procedure_assembly / objdump), [D] decompiler
pseudocode only, [S] public source 580.178.04 (file named; "S-open" = code compiled from kernel-open/, which
is the same source the original module was built from, not a reimplementation), [T] physical transcript
target/trace/b3-bar0.txt (line numbers), [O] observed in the captured ioctls
(cuda-compute-exact-allocation-ioctl-payloads.jsonl, record index = 0-based line) or the strace
reports/native-hello-original-580/syscalls-317735713.log, [E] existing emulation oracle, [I] inference.
Public tree root (abbreviated $R):
/home/geodd/nvidia-driver/analysis-580.178.04/reference/open-gpu-kernel-modules-580.178.04.
Status codes used below: OK 0, INVALID_ARGUMENT 0x1f, INVALID_BASE 0x20, INVALID_CLIENT 0x23, INVALID_FLAGS 0x29, INVALID_LIMIT 0x2e, INVALID_OBJECT 0x31, INVALID_OBJECT_HANDLE 0x33, INVALID_OBJECT_PARENT 0x36, INVALID_OFFSET 0x37, INVALID_STATE 0x40, NO_MEMORY 0x51, NOT_SUPPORTED 0x56, OBJECT_NOT_FOUND 0x57, OPERATING_SYSTEM 0x59, PROTECTION_FAULT 0x5f, INSUFFICIENT_PERMISSIONS 0x1b, STATE_IN_USE 0x63, GENERIC 0xffff.
0. What the workload does (capture decode) [O]
Decoded with a scratch script from all 55 0x4e, 39 0x4f, 1 0x5e and 55 0xd01 records. The capture is the
8-GPU run (client 0xc1d00363); 16 of the 55 maps are the two register maps on each of 8 GPUs.
| Step (record) | hDevice arg | hMemory (class) | offset, length | flags in -> out | pLinearAddress out | fd in request | mmap that follows (strace) |
|---|---|---|---|---|---|---|---|
| 78/79 | 5c000003 (class 0x2080 subdevice, the object's parent) |
5c000005 (0xc361) |
0, 0x10000 | 0x00080002 -> 0x03080002 |
0xa9810000 = BAR0 + 0x810000 |
fresh /dev/nvidiaN fd |
64 KiB, PROT_WRITE |
| 81/82 | same | 5c000006 (0x90e6) |
0, 0x1000 | 0x00080001 -> 0x03080001 |
0xa9000000 = BAR0 |
fresh /dev/nvidiaN fd |
4 KiB, PROT_READ |
| 725/726 | 5c000034 (subdevice 0x2080; the object's parent is the device 5c000033) |
5c00005b (0x40) |
0, 0x200000 | 0x000c0000 -> 0x010d0000 |
0x39a000400000 = BAR1 base + 0x400000 |
/dev/nvidia0 fd 36 |
`mmap(0x200400000, 2 MiB, RW, MAP_SHARED |
727 (0x5e) |
5c000034 |
5c00005b |
old 0x39a000400000, new 0x200400000 |
- | status 0 | - | - |
| 731/732 ... (38 x) | 5c000033 (device 0x80, the objects' parent) |
0x3e objects | 0, {0x1000 x32, 0x200000 x4, 0x5000000, 0x368d10} | 0x000c0000 (one 0x000c8000) -> 0x030c8000 |
physical address of the first page, e.g. 0x269362a000 |
fresh /dev/nvidiactl fd |
`mmap(addr, len, RW, MAP_SHARED |
- Every map is preceded by control
0xd01on the client with{hObject, mapFlags = the flags about to be used with the low access bits, 0}; replies: 0xc361 -> 3, 0x90e6 -> 3, 0x40 -> 2, 0x3e -> 1 (55 of 55 records, all status 0). ThemapFlagssent are0x00080002,0x00080001,0x000c0000,0x000c8000(same values as the map call). - Input flag bits used by libcuda: bit 19
RESERVE_ON_UNMAPalways; bit 18MAP_FIXEDfor memory objects; bits 1:0 access (2 = write-only for the doorbell page, 1 = read-only for the PMC page, 0 = read/write); bit 15MAPPING_DIRECTonce (object5c000063). Bits 18/19 are not interpreted by kernel RM on Linux; they are consumed by the userspace library (it does theMAP_FIXEDmmap itself, and on unmap overlays the range withmmap(addr, len, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS)instead ofmunmap: strace lines 2015/2019) [O]+[S: no reference toNVOS33_FLAGS_MAP_FIXED/RESERVE_ON_UNMAPinsrc/nvidia]. - pLinearAddress for system memory is not a kernel cookie; it is the CPU physical address of the first mapped page
plus the in-page offset (
nv_alloc_user_mapping, section 1.5). In the capture the values are0x26......../0x27........(host RAM above 152 GiB), page aligned. This correctsrmapi-userspace.md3.3 ("kernel cookie"). - Unmap (39 records):
{hClient, hDevice as in the map, hMemory, pLinearAddress, status, flags = 0}. For the 38 system objectspLinearAddressis the value returned by the map. For the 0x40 object the unmap passes0x200400000, the new address registered with0x5e(record 1444), which is what makes0x5emandatory: the mapping record's key was rewritten (section 4). The 16 register mappings are never unmapped explicitly; they go away with the object/client free. - The strace shows the sequence
openat(node) -> ioctl(ctl fd, 0x4e, ... fd) -> mmap(fd, off 0) -> close(fd)for every mapping; the VMA keeps the file alive afterclose.
1. NV_ESC_RM_MAP_MEMORY RM side
1.1 Parameter block (nv_ioctl_nvos33_parameters_with_fd, 56 bytes) [S nvos.h:1845, nv-unix-nvos-params-wrappers.h] + [O]
| Off | Field | Dir | Notes |
|---|---|---|---|
| 0x00 | hClient u32 |
in | must be a client owned by the calling process (rm_create_mmap_context), else 0x23 |
| 0x04 | hDevice u32 |
in | a Device or Subdevice handle of the client, or hClient itself for client-parented memory. A Subdevice is replaced by its parent Device internally, the Subdevice staying as "context" (hContext) |
| 0x08 | hMemory u32 |
in | object to map (Memory subclass or GpuResource subclass) |
| 0x0c | pad | ||
| 0x10 | offset u64 |
in | byte offset inside the object |
| 0x18 | length u64 |
in | bytes; not required to be page aligned (0x368d10 in the capture) |
| 0x20 | pLinearAddress u64 |
out | section 1.5. Input value ignored (0 in the capture) |
| 0x28 | status u32 |
out | NV status of map, or of the mmap-context step if map succeeded |
| 0x2c | flags u32 |
in/out | caching field overwritten on input; mapping/caching fields rewritten on output (1.4) |
| 0x30 | fd i32 |
in | fd of the node file that will be mmap()ed; only used by rm_create_mmap_context |
| 0x34 | pad |
Dispatcher (escape.c:513, closed _nv000800rm, [A] in rmapi-userspace.md 3.1): size must be 0x38 (else ioctl
status 0x1f), must arrive on the control node, flags = FLD_SET(CACHING_TYPE, DEFAULT) i.e.
(flags & 0xfc7fffff) | 0x03000000, Nv04MapMemoryWithSecInfo (_nv000661rm), and only if status == 0:
status = rm_create_mmap_context(hClient, hDevice, hMemory, pLinearAddress, length, offset, (flags >> 23) & 7, fd)
(_nv054155rm); if that fails, an NVOS34 {hClient, hDevice, hMemory, pLinearAddress, flags} is unmapped
(_nv000667rm) and the failing status is what the caller sees.
1.2 Flags (NVOS33_FLAGS_*, nvos.h:1732-1841) [S]
| Bits | Name | Kernel RM use on this path |
|---|---|---|
| 1:0 | ACCESS 0 RW / 1 RO / 2 WO | -> protect 3 / 1 / 2 (serverMap_Prologue); value 3 -> 0x29 |
| 4 | PERSISTENT | set -> 0x29 |
| 8 | SKIP_SIZE_CHECK | kernel-privileged only, else 0x1b (memMap) |
| 14 | MEM_SPACE 0 CLIENT / 1 USER | from a user client: USER -> 0x29 (rmapiValidateKernelMapping); user clients always get bKernel = FALSE |
| 16:15 | MAPPING 0 default / 1 DIRECT / 2 REFLECTED | input: only DIRECT matters, and only for video memory (sets BUS_MAP_FB_FLAGS_DISABLE_ENCRYPTION, no effect on GV100). Output: memMap sets DIRECT for system memory, REFLECTED for BAR1 mappings. memUnmap dispatches on the stored value |
| 17 | FIFO_MAPPING | not referenced in src/nvidia/src/kernel/rmapi or mem_mgr on this path (grep) |
| 18, 19 | MAP_FIXED, RESERVE_ON_UNMAP | not interpreted in the kernel (userspace library only) |
| 22 | OS_DESCRIPTOR | internal; set by the caller -> 0x29. memUnmap skips all work when the stored flags have it |
| 25:23 | CACHING_TYPE | forced to 6 (DEFAULT) by the dispatcher; rewritten by memMap for BAR1 mappings only |
| 26 | ALLOW_MAPPING_ON_HCC | confidential compute only |
1.3 Order of checks [S rs_server.c:1983 serverMap, mapping_cpu.c]
Nv04MapMemoryWithSecInfo -> rmapiMapToCpuWithSecInfoV2 (RM_API +0x80) -> serverMap(&g_resServ, hClient, hMemory, params):
| # | Step | Failure status |
|---|---|---|
| 1 | rmapiPrologue, rmapiInitLockInfo(hClient); top (API) lock |
lock errors |
| 2 | client lock (write) by hClient; pClient->bActive; clientValidate(secInfo) |
0x23 unknown client; 0x40 inactive |
| 3 | clientGetResourceRef(hMemory); pResource != NULL |
0x57 unknown handle; 0x56 |
| 4 | serverMap_Prologue: PERSISTENT flag -> 0x29; client lookup; second clientGetResourceRef(hMemory); rmapiValidateKernelMapping (1.2: 0x29); if hDevice != hClient: the object's parent must not be the client (0x36), clientGetResourceRef(hDevice) (0x57), its internal class must be Device or Subdevice (0x36), lock flags GPU_GROUP_LOCK, pContextRef = that ref; if hDevice == hClient the object's parent must be the client (0x36). hContext = subdevice handle if one was given, else hDevice. ACCESS decode (0x29) |
as listed |
| 5 | resource lock (GPU group lock of the context device) | |
| 6 | clientGetResourceRef(hContext) |
0x57 |
| 7 | refAddMapping: append a new RsCpuMapping to pResourceRef->cpuMappings, allocate pPrivate (protect, bKernel); record offset, length, flags, pContextRef, pResourceRef; add a back-reference on the context ref unless the context is the object itself or one of its ancestors |
0x51 |
| 8 | resMap(pResource, callContext, params, pCpuMapping) (virtual; table below) |
per class |
| 9 | on success *ppCpuVirtAddr = pCpuMapping->pLinearAddress; on failure refRemoveMapping |
|
| 10 | output flags = rmMapParams.flags |
resMap per class [S: generated g_*_nvoc.c vtables show sysmemMap, vidmemMap, osdescMap, usrmodeMap are all
"virtual inherited (mem)" thunks to memMap_IMPL; genapiMap_IMPL is its own body]:
| Class (workload) | Internal class | resMap body |
Address space |
|---|---|---|---|
| 0x3e NV01_MEMORY_SYSTEM | SystemMemory : StandardMemory : Memory | memMap_IMPL |
ADDR_SYSMEM |
| 0x40 NV01_MEMORY_LOCAL_USER | VideoMemory : StandardMemory : Memory | memMap_IMPL |
ADDR_FBMEM |
| 0x71 NV01_MEMORY_SYSTEM_OS_DESCRIPTOR | OsDescMemory : Memory | memMap_IMPL |
rejected with 0x56 unless the descriptor has MEMDESC_FLAGS_ALLOW_EXT_SYSMEM_USER_CPU_MAPPING (never mapped by the workload) |
| 0xc361 VOLTA_USERMODE_A | UserModeApi : Memory (memdesc = pKernelFifo->pRegVF, class id 0x3f, ADDR_REGMEM, _pteArray[0] = 0x810000, size 0x10000) |
memMap_IMPL, REGMEM branch |
ADDR_REGMEM |
| 0x90e6 GF100_SUBDEVICE_MASTER | GenericEngineApi : GpuResource | genapiMap_IMPL -> rmapiMapGpuCommon |
ADDR_REGMEM (genapiGetMapAddrSpace_IMPL) |
memMap_IMPL checks, in order [S mapping_cpu.c:120]:
| # | Check | Status |
|---|---|---|
| 1 | pLockInfo != NULL; GPU from the context ref (gpuGetByRef) |
0x1f |
| 2 | client lookup; clientGetResourceRef(hMemory); dynamic cast to Memory |
0x23; 0x57; 0x56 |
| 3 | OS-descriptor memory: supported only with ALLOW_EXT_SYSMEM_USER_CPU_MAPPING | 0x56 |
| 4 | non-CC GPU: object allocated with NVOS32_ALLOC_FLAGS_PROTECTED and protect != WRITEABLE(2) |
0x56 |
| 5 | user mapping of an object with ATTR2 PROTECTION_USER READ_ONLY and protect != READABLE(1) |
0x1f |
| 6 | offset >= pMemory->Length |
0x20 |
| 7 | length == 0 |
0x2e |
| 8 | SKIP_SIZE_CHECK from below kernel privilege | 0x1b |
| 9 | offset + length overflows, or > pMemory->Length (unless SKIP_SIZE_CHECK) |
0x2e |
| 10 | kbusGetEffectiveAddressSpace_HAL(memdesc, flags) -> effectiveAddrSpace; FlaMemory -> 0x56 |
|
| 11 | branch on address space: 1.5 |
Length is the object's size as recorded by memConstructCommon (for 0x40 the size rounded up to the page, for 0x3e
the requested size rounded to 4 KiB [I from the replies in rmapi-memory-slice-progress.md]).
genapiMap_IMPL (0x90e6) [S generic_engine.c]: regBase = NV_REG_BASE_MASTER, regSize = sizeof(GF100MASTERMap)
(0x1000 [O: the workload maps exactly 0x1000]), allowed protect = READABLE only: any other requested bit ->
0x5f PROTECTION_FAULT. Then rmapiMapGpuCommon: offset >= regSize -> 0x20; length == 0 -> 0x2e;
offset + length > regSize -> 0x2e; osMapGPU(pGpu, privLevel, engineOffset + offset, length, protect). The
RsCpuMapping.flags stay as passed in (no DIRECT/REFLECTED), processId = current.
1.4 Output flags, explained [S] + [O]
| Kind | Code path | Output | Capture |
|---|---|---|---|
| registers (0xc361, 0x90e6) | REGMEM branch / genapiMap never touch flags |
input with caching 6 (dispatcher) | 0x03080002, 0x03080001 |
| system memory | flags = FLD_SET(MAPPING, DIRECT) -> bit 15 set, bit 16 clear; caching stays 6 |
0x030c8000 |
38/38 |
| video memory through BAR1 | flags = FLD_SET(MAPPING, REFLECTED) (bit 16), then FLD_SET_NUM(CACHING_TYPE, cachingType) with cachingType = NV_MEMORY_WRITECOMBINED (2) unless the descriptor has MEMDESC_FLAGS_MAP_SYSCOH_OVER_BAR1 (then UNCACHED 1) |
0x010d0000 = caching 2, MAP_FIXED, RESERVE, REFLECTED |
1/1 |
So "6" is simply the dispatcher's forced DEFAULT surviving, and "2" is the write-combined choice of the BAR1 branch.
The caching value handed to rm_create_mmap_context is taken from the output flags (6 or 2).
1.5 What each branch does and what pLinearAddress is [S]
| Kind | Calls | pLinearAddress |
Mapping record |
|---|---|---|---|
| system memory (user client) | memdescMap -> osMapSystemMemory(pMemDesc, offset, length, Kernel = 0, protect): offset + length overflow or > pMemDesc->Size -> 0x1f; no memData -> 0x40; nv_alloc_user_mapping(nv, at, pageIndex = offset >> 12, pageOffset = offset & 0xfff, ...) |
at->page_table[pageIndex].phys_addr + pageOffset (contiguous alloc: page_table[0].phys_addr + pageIndex*4096 + pageOffset). No kernel mapping, no state is created |
CliUpdateMemoryMappingInfo: bKernel 0, length, flags (with DIRECT), processId = osGetCurrentProcess(), pLinearAddress, pPriv = NULL, memArea zeroed; pPrivate->pGpu |
| video memory, BAR1 virtual mode (GV100) | `kbusMapFbAperture_HAL(pGpu, pKernelBus, pMemDesc, range(offset, length), &memArea, BUS_MAP_FB_FLAGS_MAP_UNICAST | ALLOW_DISCONTIG (user) | READ_ONLY/WRITE_ONLY by protect |
registers through memMap (0xc361) |
non-admin client and no MEMDESC_FLAGS_SKIP_REGMEM_PRIV_CHECK -> 0x5f; osMapGPU(pGpu, privLevel, offset + pMemDesc->_pteArray[0], length, protect) |
BAR0 CPU physical base + register offset (0xa9810000) |
CliUpdateDeviceMemoryMapping(..., 0, 0, flags) |
registers through genapiMap (0x90e6) |
osMapGPU as above with engineOffset & ~0xfff |
BAR0 base + 0 (0xa9000000) |
set by rmapiMapGpuCommon (pLinearAddress, pPriv) + processId |
| ADDR_VIRTUAL | - | - | 0x56 |
| other | - | - | NV_ERR_INVALID_CLASS |
osMapGPU for a user client [S os.c]: busAddress = pGpu->busInfo.gpuPhysAddr + offset (overflow -> 0x2e), then
osMapPciMemoryUser(..., modeFlag = NV_FALSE). osMapPciMemoryAreaUser creates no mapping: it page-aligns the
first range start down and the last range size up, builds a nv_usermap_access_params_t {memArea (copied),
access_start = first range start, access_size = one OS page, caching = mode, contig = 1}, runs
nv_check_usermap_access_params (4K-page-isolation check, irrelevant on x86-64), and parks it in the thread-local
slot TLS_ENTRY_ID_MAPPING_CONTEXT; returns *pVirtualAddress = aligned start + in-page offset, *pPriv untouched.
rm_create_mmap_context picks the slot up afterwards (section 2). osUnmapPciMemoryUser is empty.
1.6 Per-client CPU mapping records [S rs_resource.h:460, g_resource_nvoc.h:126, rs_resource.c]
RsCpuMapping (one list per RsResourceRef, i.e. per client handle): offset, length, flags (as rewritten),
pLinearAddress, pContextRef (Device or Subdevice ref given as hDevice), pResourceRef, backRefNode,
pContext, processId, pPrivate -> RS_CPU_MAPPING_PRIVATE { MemoryArea memArea; OBJGPU *pGpu; NvP64 pPriv; NvU32 protect; NvBool bKernel; MemoryRange backingRangeStore; }.
| Rule | Evidence |
|---|---|
| No duplicate detection: every successful map appends a record, including two maps of the same range | [S] refAddMapping |
Lookup for unmap and for 0x5e: first record in list order with pLinearAddress == address and filter !bKernel && processId == osGetCurrentProcess() (user clients). Not found -> 0x57. Neither handle of device, offset nor length take part |
[S] refFindCpuMappingWithFilter, serverutilMappingFilterCurrentUserProc |
A dup'ed object (RM_DUP_OBJECT) is a new RsResourceRef with an empty mapping list; mappings are not inherited |
[S] list lives in the ref; [I] not exercised by the workload |
Freeing the object (or the context Device/Subdevice, through backRefs, or the client) unmaps every record first (bTeardown, no filter) |
[S] serverUnmap_Prologue teardown branch; resource-server free path not read line by line: [I] for the exact order |
Two system-memory maps of the same object at the same offset return the same pLinearAddress (same physical page); unmap then removes the first one in list order |
[I] from the two rules above |
2. rm_create_mmap_context and the per-file mapping context
2.1 rm_create_mmap_context (closed _nv054155rm) [S osapi.c:2394]; closed check in section 6
| # | Step | Failure |
|---|---|---|
| 1 | rmapiLockAcquire(READ, RM_LOCK_MODULES_OSAPI) |
its status |
| 2 | serverutilAcquireClient(hClient, READ) |
0x23 (API lock released) |
| 3 | pRmClient->ProcID != osGetCurrentProcess() |
0x23 |
| 4 | rmGpuLocksAcquire(GPUS_LOCK_FLAGS_NONE, OSAPI) (all GPUs) |
its status |
| 5 | RmCreateMmapContextLocked(pRmClient, hDevice, hMemory, address, size, offset, cachingType, fd) |
below |
| 6 | release GPUs lock, client, API lock |
Lock order: API lock (read) -> client entry (read) -> all-GPUs lock -> (inside nv_add_mapping_context_to_file)
fget(fd) only; no mmap_lock, no ldata_lock. The mmap itself later takes nvl->mmap_lock (BAR path only).
2.2 RmCreateMmapContextLocked [S osapi.c:2231]
bClientMap = (hDevice == hClient). OtherwiseCliSetGpuContext(hClient, hDevice)(Device) orsubdeviceGetByHandle(failure status returned) givespGpu.- TLS shortcut: if
tlsEntryGet(TLS_ENTRY_ID_MAPPING_CONTEXT)is non-NULL (i.e.osMapPciMemoryAreaUserran in this ioctl: every BAR0/BAR1 mapping), release the TLS entry, setprot = NV_PROTECT_READ_WRITE,pNv = NV_GET_NV_STATE(pGpu), and go straight tonv_add_mapping_context_to_file. Theaddress/size/offset/ cachingTypearguments are not used on this path, and neitherRmValidateMmapRequestnor the access flags of the map call limitprot(so a read-only register map still yields a context with prot 3; the read-only property of 0x90e6 is enforced only bygenapiMaprefusing a writable request, section 3.3 note). - Otherwise allocate
nvuap:addr = address,size,offset,caching = cachingType,contig = 1;nv_align_mmap_offset_length:memArea = {1 range: start = ALIGN_DOWN(addr, 4K), size = ALIGN_UP(size + (addr & 0xfff), 4K)},offset = ALIGN_DOWN(offset, 4K). - If there is no GPU, or
addr..addr+size-1is in none of: BAR0 (IS_REG_OFFSET:nv->regs), BAR1 (IS_FB_OFFSET:nv->fb), coherent-FB ranges (not GV100), IMEM BAR: system memory:pNv = nv_get_ctl_state();RmGetAllocPrivate(client, hMemory, addr, size, &prot, &pAllocPriv, &pageIndex). - Else (direct BAR address without TLS entry; not reached by the workload [I]):
RmSetUserMapAccessRange(access_start/size= the range),nv_check_usermap_access_params,RmValidateMmapRequest(admin -> RW; else internal controlNV2080_CTRL_CMD_GPU_VALIDATE_MEM_MAP_REQUESTdecidesprot). nv_add_mapping_context_to_file(pNv, nvuap, prot, pAllocPriv, pageIndex, fd); freenvuap.
RmGetAllocPrivate (system memory validation) [S osapi.c:2443]:
| # | Check | Status |
|---|---|---|
| 1 | pageOffset = addr & 0xfff; addr &= ~0xfff; API lock owned |
0x2f |
| 2 | clientGetResourceRef(hMemory); cast to RmResource; rmresGetMemoryMappingDescriptor |
0x57; 0x31; its status |
| 3 | descriptor Allocated (or peer-IO / carveout / ALLOW_EXT_SYSMEM_USER_CPU_MAPPING) |
0x57 |
| 4 | descriptor address space is SYSMEM (or EGM) | 0x57 |
| 5 | memdescGetMemData != NULL |
0x57 |
| 6 | os_match_mmap_offset(at, addr, &pageIndex): linear search for the page whose phys_addr == addr (contiguous: page_table[0].phys_addr + i*4K) |
0x57 |
| 7 | pageOffset + length overflow; pageIndex + ceil((pageOffset + length)/4K) overflow or > PageCount |
0x1f |
| 8 | prot = READABLE if MEMDESC_FLAGS_USER_READ_ONLY, else READ_WRITE; *ppPrivate = at |
Consequence for an implementation: the "address" returned by map must be something from which the kernel side can
find the page index again. The original uses the page's physical address; any injective per-allocation cookie works
as long as map and os_match_mmap_offset agree, but libcuda passes the value back verbatim in unmap, so it must
be unique among the live mappings of one object (it is the lookup key, 1.6).
2.3 nv_add_mapping_context_to_file [S-open kernel-open/nvidia/nv-usermap.c:29]
| # | Step | Status |
|---|---|---|
| 1 | nv_get_file_private(fd, ctl = NV_IS_CTL_DEVICE(nv), &priv): fget(fd); inode major must be the NVIDIA major; for ctl the minor must be the control minor (255), otherwise the minor must be a registered device minor (nv_linux_minor_num_table[minor] != NULL) |
0x1f (bad fd, foreign file, wrong node kind) |
| 2 | nvamc = &nvlfp->mmap_context; smp_load_acquire(&nvamc->valid) true |
0x63 STATE_IN_USE (one context per file, for the life of the file: valid is never cleared) |
| 3 | memset(nvamc, 0) |
|
| 4a | control node: alloc = pAllocPriv (the nv_alloc_t), page_index = pageIndex, atomic64_inc(&at->usage_count) |
|
| 4b | device node: NV_STATE_PTR(nvlfp->nvptr) != nv (fd opened on another GPU's node) |
0x1f |
copy memArea (allocated array of ranges); page_array/num_pages only if NUMA status is ONLINE (never on GV100); access_start, access_size |
0x51 | |
| 5 | prot = prot; caching = nvuap->caching; smp_store_release(&valid, TRUE) |
|
| 6 | nv_put_file_private (fput) |
Which node the fd must be for each kind:
| Kind | pNv passed |
fd must be | Context contents for the workload |
|---|---|---|---|
| 0x3e system memory | control state | /dev/nvidiactl |
alloc = at, page_index = 0, prot = 3, caching = 6 (unused at mmap; at->cache_type rules), memArea empty |
| 0x40 through BAR1 | that GPU | that GPU's /dev/nvidiaN |
memArea = {BAR1 base + VA, 0x200000} (one range per contiguous BAR1 run), access_start = first page, access_size = 0x1000, prot = 3, caching = 2 |
| 0xc361 | that GPU | same | memArea = {BAR0 + 0x810000, 0x10000}, access_size 0x1000, prot 3, caching 0 (modeFlag = NV_FALSE) |
| 0x90e6 | that GPU | same | memArea = {BAR0, 0x1000}, prot 3, caching 0 |
nv_usermap_access_params_t [S-open nv.h:360]: addr, size, offset, page_array, num_pages, memArea{pRanges, numRanges}, access_start, access_size, contig, caching.
nv_alloc_mapping_context_t [S-open nv.h:377]: alloc, page_index, page_array, num_pages, memArea, access_start, access_size, prot, valid, caching. (The names mmap_start/mmap_size/remap_prot_extra of older driver branches do
not exist in 580; their role is taken by memArea.)
3. mmap, munmap, close, RM_UNMAP_MEMORY
3.1 nvidia_mmap -> nvidia_mmap_helper [S-open kernel-open/nvidia/nv-mmap.c]
| # | Rule | errno |
|---|---|---|
| 1 | file has exported RM handles (nvlfp->nvfp.handles != NULL) |
-EINVAL |
| 2 | device node: wait for the deferred open to complete (interruptible); nvlfp->nvptr == NULL |
its error; -EIO |
| 3 | mmap_context.valid not set (no RM_MAP_MEMORY named this fd) |
-EINVAL |
| 4 | vma->vm_pgoff != 0 (offset must be 0) |
-EINVAL |
| 5 | nv_check_gpu_state(nv) (GPU lost / surprise removal) |
positive NV status returned as-is |
| 6 | node-specific part (3.2 / 3.3) | |
| 7 | if !(prot & NV_PROTECT_WRITEABLE): vm_page_prot read-only, clear VM_WRITE and VM_MAYWRITE |
|
| 8 | vma->vm_ops = &nv_vm_ops |
The user's PROT_* is not compared with the context: a PROT_WRITE request on a read-only context succeeds and
is silently downgraded (step 7). A context may be mmap()ed any number of times (nothing consumes it).
3.2 Control node (system memory) [S-open]
| Rule | Detail |
|---|---|
| Length | pages = vma size >> 12; page_index + pages > at->num_pages -> -ERANGE. Shorter than the context is allowed; the mapping always starts at page_index (in-page offset is the caller's business: userspace adds pLinearAddress & 0xfff) |
| Private data | BUG_ON(NV_VMA_PRIVATE(vma)), then vm_private_data = at |
| Caching | nv_encode_caching(&vm_page_prot, at->cache_type, NV_MEMORY_TYPE_SYSTEM): CACHED (0) -> unchanged; UNCACHED (1) -> pgprot_noncached; WRITECOMBINED (2) / DEFAULT (6) -> pgprot_writecombine if PAT enabled, else failure; UNCACHED_WEAK (7) -> pgprot_noncached_weak; failure -> -ENXIO. The workload's 0x3e objects have cache_type 0 or 2 (nv_alloc_pages(..., cache 0 or 2, ...), progress log) |
Insertion (nvidia_mmap_sysmem) |
atomic64_inc(&at->usage_count); per page vm_insert_page(vma, start, pfn_to_page(page_table[j].phys_addr >> 12)) (sets VM_MIXEDMAP); for at->flags.unencrypted first nv_adjust_pgprot. Carveout or imported (import_sgt) allocations use remap_pfn_range per page instead. Failure: usage count dropped, -EAGAIN |
Peer-IO allocations (at->flags.peer_io) |
nv_encode_caching(..., NV_MEMORY_TYPE_DEVICE_MMIO), vm_private_data = NULL, one remap_pfn_range of the contiguous range, `VM_IO |
| vm_flags | `VM_SHARED |
| Fault | never expected (all pages inserted eagerly); nvidia_fault on the control node returns VM_FAULT_SIGBUS |
3.3 Device node (BAR0 / BAR1) [S-open]
| Rule | Detail |
|---|---|
| Length | vma size != sum(memArea ranges) -> -ENXIO (exact match; ranges were page-rounded by osMapPciMemoryAreaUser) |
Classification by access_start, access_size (one page) |
in BAR0 (IS_REG_OFFSET): pgprot_noncached (UNCACHED, type REGISTERS), the stored caching is ignored. In BAR1 (IS_FB_OFFSET): if inside the "UD" sub-range (nv->ud, unused on GV100: cpu_address == 0 [I]) UNCACHED; else caching from the context (2 -> pgprot_writecombine), or UNCACHED if PDB_PROP_CL_DISABLE_IOMAP_WC; if write-combining is unavailable (PAT disabled) fall back to UNCACHED_WEAK; failure -> -ENXIO. Neither BAR: vm_page_prot left as is |
| Insertion | under nvl->mmap_lock: if nvl->safe_to_mmap: all_mappings_revoked = FALSE and, per range, nv_io_remap_page_range(vma, range.start, range.size, vm_start + running offset) = remap_pfn_range(..., nv_adjust_pgprot(vm_page_prot)) on x86 (io_remap_pfn_range only under Xen); failure -> -EAGAIN. (NUMA-online path nvidia_mmap_numa/vm_insert_page is for coherent-link systems, not GV100.) If safe_to_mmap is false nothing is inserted and the mapping is populated by nvidia_fault later |
| vm_flags | `VM_IO |
vm_private_data |
NULL (nvidia_mmap passes vm_priv = NULL) |
Low power / revocation [S-open nv-mmap.c, nv.c:4420-4475]: nv_set_safe_to_mmap_locked(FALSE) +
nv_revoke_gpu_mappings_locked (unmap_mapping_range(&nvlfp->mapping, 0, ~0, 1) for every open file of the GPU;
each file has its own address_space, set up in nvidia_open: file->f_mapping = &nvlfp->mapping) run from
nv_preempt_user_channels (system suspend path, nv.c:4445) and from RM through nv_set_safe_to_mmap_locked /
nv_revoke_gpu_mappings when the GPU enters a state where BARs must not be touched (runtime D3). A later access faults:
nvidia_fault: vm_pgoff != 0 or control node -> SIGBUS; down_read_trylock(nv_system_pm_lock) fails -> NOPAGE
(retry); under mmap_lock: if !safe_to_mmap: schedule rm_schedule_gpu_wakeup once
(gpu_wakeup_callback_needed), return NOPAGE; else re-insert all pages of all ranges with
vmf_insert_pfn_prot and clear all_mappings_revoked. On a data-center V100 with runtime PM unused,
safe_to_mmap is TRUE from open to close [I]; a minimal implementation needs only "insert at mmap time" plus a
fault handler that returns SIGBUS, provided it never revokes.
vm_ops [S-open]:
| Op | Behaviour |
|---|---|
open (VMA split/copy, fork) |
at = vm_private_data; if non-NULL atomic64_inc(&at->usage_count) |
close |
if at != NULL and nv_alloc_release(nvlfp, at) (usage count reached 0 -> count restored to 1 and at queued on nvlfp->free_list): "late unmap" message. The pages are then freed by nvidia_ctl_close (nv_free_pages over free_list) |
fault |
above |
access (ptrace//proc/pid/mem) |
context must be valid; write needs prot & WRITEABLE (-EACCES); control node: copy via at->page_table[idx].virt_addr; device node: locate the range, os_map_kernel_space(page, 4K, UNCACHED), memcpy, unmap; at most to the end of the page |
3.4 munmap and file close [S-open]
| Event | Effect |
|---|---|
munmap / overlay with anonymous mapping |
kernel calls vm_ops->close (system memory: usage count; BAR: nothing). RM is not told; the RsCpuMapping and, for BAR1, the BAR1 virtual range and its PTEs stay until RM_UNMAP_MEMORY or object free |
close(fd) right after mmap (the workload's pattern) |
nothing yet: the VMA holds the file |
last reference to the file dropped (control node: nvidia_ctl_close) |
rm_cleanup_file_private; if mmap_context.valid && alloc != NULL: nv_alloc_release(nvlfp, at) (drops the reference taken by nv_add_mapping_context_to_file); then every at on free_list is freed with nv_free_pages; finally (nv.c:1058, shared free path) page_array and memArea.pRanges of the context are freed |
| RM frees the 0x3e object while user mappings exist | nv_free_pages sees usage_count still raised and defers; the real free happens through free_list at file close (comment block at the top of nv-mmap.c). An implementation must keep pages alive until the last VMA and the context-holding file are gone |
3.5 NV_ESC_RM_UNMAP_MEMORY (NVOS34, 32 bytes) [S nvos.h:1861, mapping_cpu.c, rs_server.c:2108]
{hClient u32, hDevice u32, hMemory u32, pad, pLinearAddress u64 (in), status u32 (out), flags u32 (in)}; size
0x20, control node. Nv04UnmapMemoryWithSecInfo (_nv000667rm) -> rmapiUnmapFromCpuWithSecInfo(..., ProcessId = current) -> serverUnmap:
| # | Step | Status |
|---|---|---|
| 1 | rmapiInitLockInfo fails (unknown client) |
returns OK (0) |
| 2 | top lock, client lock, clientValidate |
|
| 3 | clientGetResourceRef(hMemory) |
0x57 |
| 4 | serverUnmap_Prologue: as map for hDevice (parent rules 0x36, lookup 0x57, Device/Subdevice 0x36); bKernel = FALSE for user clients; filter = current-user-process |
|
| 5 | refFindCpuMappingWithFilter(ref, pLinearAddress, filter) |
0x57 if no record has that address in this process |
| 6 | resource lock; clientUnmapMemory -> resUnmap (below) -> refRemoveMapping (also removes the context back-reference, frees pPrivate) |
flags of the unmap call are only used for MEM_SPACE (kernel clients). The capture passes 0 [O]; the behaviour
is driven by the flags stored in the record at map time.
memUnmap_IMPL by stored state [S]:
| Record | Action |
|---|---|
| flags has OS_DESCRIPTOR | nothing |
| no GPU, or SYSMEM descriptor with MAPPING == DIRECT | memdescUnmap -> osUnmapSystemMemory -> nv_free_user_mapping (empty function) |
| FBMEM descriptor (or SYSMEM with REFLECTED) | RmUnmapBusAperture -> osUnmapPciMemoryUser (empty); then, BAR1 virtual mode: kbusUnmapFbAperture_HAL(pGpu, pKernelBus, pMemDesc, pPrivate->memArea, BUS_MAP_FB_FLAGS_MAP_UNICAST): BAR1 PTEs cleared, VA range freed (section 5.4) |
| REGMEM descriptor | osUnmapGPU -> empty for user clients |
gpuresUnmap_IMPL (0x90e6): osUnmapGPU only. Always returns OK.
So on Linux, user unmap = remove the record (+ BAR1 teardown for video memory). It does not tear down the process's VMA; if userspace keeps the VMA after unmapping a BAR1 mapping, the PFNs still point into BAR1 and reads hit whatever is mapped there next (or the unmapped-PTE behaviour). libcuda overlays the range first [O].
4. RM_UPDATE_DEVICE_MAPPING_INFO and GET_ADDR_SPACE_TYPE
4.1 NV_ESC_RM_UPDATE_DEVICE_MAPPING_INFO 0x5e (NVOS56, 40 bytes) [S nvos.h:2286, escape.c:786, osapi.c:959,3499]
{hClient u32 @0, hDevice u32 @4, hMemory u32 @8, pad, pOldCpuAddress u64 @0x10, pNewCpuAddress u64 @0x18, status u32 @0x20, pad}. Capture record 727: 63 03 d0 c1 | 34 00 00 5c | 5b 00 00 5c | 0 | 0x39a000400000 | 0x200400000 | 0 -> status 0.
rm_update_device_mapping_info (closed _nv054198rm): API lock (read, module GPU) -> RmUpdateDeviceMappingInfo:
| # | Step | Status |
|---|---|---|
| 1 | serverAcquireClient(hClient, WRITE) |
its status |
| 2 | deviceGetByHandle(hDevice); if that fails subdeviceGetByHandle(hDevice); GPU group lock (device or subdevice group) |
lookup status |
| 3 | clientGetResourceRef(hMemory) |
0x57 |
| 4 | resource must cast to Memory, KernelCcuApi or KernelChannel | 0x33 |
| 5 | refFindCpuMappingWithFilter(ref, pOldCpuAddress, current-user-process filter) |
0x57 |
| 6 | pCpuMapping->pLinearAddress = pNewCpuAddress |
|
| 7 | release GPU lock, client |
It records nothing else: no VMA lookup, no validation of the new address, no hardware access. Its only effect is
that later RM_UNMAP_MEMORY (and a second 0x5e) must use the new address as key [S]+[O record 1444]. libcuda
issues it only for the BAR1 mapping (1 of 55) [O]; for system memory it keeps using the physical-address key.
4.2 NV0000_CTRL_CMD_CLIENT_GET_ADDR_SPACE_TYPE 0xd01 [S client_resource.c cliresCtrlCmdClientGetAddrSpaceType_IMPL, ctrl0000client.h]; closed _nv019591rm
Params (12 bytes): hObject u32 in, mapFlags u32 in, addrSpaceType u32 out. Constants: INVALID 0, SYSMEM 1,
VIDMEM 2, REGMEM 3, FABRIC 4, FABRIC_MC 5.
Logic: clientGetResourceRef(hObject) (assert-return of the lookup status, 0x57); if the resource is a Memory:
memGetMapAddrSpace(pMemory, ctx, mapFlags, &type) = kbusGetEffectiveAddressSpace_HAL(memdesc, mapFlags), then a
SYSMEM result becomes REGMEM / FBMEM if the descriptor has MEMDESC_FLAGS_BAR0_REFLECT / BAR1_REFLECT
(pMemory->pGpu == NULL -> 0x31); else if it is a GpuResource: gpuresGetMapAddrSpace (virtual; default = REGMEM
if the class has a register base, else its error); else 0x31. ADDR_VIRTUAL or unknown -> type 0 and 0x1f.
| Object | Path | Reply | Capture |
|---|---|---|---|
| 0xc361 | Memory, descriptor pRegVF is ADDR_REGMEM |
3 | 8/8 records = 3 (mapFlags 0x00080002) |
| 0x90e6 | GpuResource, genapiGetMapAddrSpace_IMPL = REGMEM unconditionally |
3 | 8/8 = 3 (0x00080001) |
| 0x40 | Memory, FBMEM | 2 | 1/1 = 2 (0x000c0000) |
| 0x3e | Memory, SYSMEM, no reflect flags | 1 | 38/38 = 1 (0x000c0000, one 0x000c8000) |
mapFlags influences the answer only inside kbusGetEffectiveAddressSpace_HAL (section 5.3.1: on GV100 it does not).
5. BAR1 CPU mapping of video memory: implementation requirement
Transcript sources: BAR0 target/trace/b3-bar0.txt (line numbers) and the BAR1/BAR2 run-length extract
target/trace/b3-bar12-rle.txt (times; E = decoded access, Z = run of byte-wide zero writes, U = rep movsb
whose data is not recorded, only address and length). BAR2 offsets below are BAR2 virtual addresses. All of this
is one boot of board b3; addresses that come from the internal heap are specific to it.
5.1 kbusInitBar1_GM107 (closed _nv039462rm, KernelBus slot +0x470), called from KernelBus PostLoad
| # | Step | Evidence |
|---|---|---|
| 1 | Return 0 if bar1[gfid].pVAS (+0x5e0) already exists. vaRangeMax = bar1.apertureLength (+0x5d0) - 1; apertureLength = PCI BAR1 size unless shrunk by registry RMBar1ApertureSizeMB (kbusDetermineBar1ApertureLength, PreInit) |
[D] _nv039462rm; [S] kern_bus.c:541 |
| 2 | vmmCreateVaspace(vmm, class 0x90f1 FERMI_VASPACE_A, 0, gpuMask = 1 << gpuInstance, vaStart 0, vaLimit apertureLength - 1, 0, 0, NULL, flags, &bar1.pVAS) with flags 0x04080081 on the PF = `VASPACE_FLAGS_BAR (bit 0) |
BAR_BAR1 (bit 7) |
| 2a | Inside the vaspace constructor for a BAR1 space on a non-GSP build: mmuWalkSparsify(walk, 0, vaLimit, FALSE) (_gvaspaceBar1VaSpaceConstructClient). Page-table pages of a VASPACE_FLAGS_BAR space are not from the PMA page-table pool: gmmuWalkCBLevelAlloc takes aperture/attr from KernelGmmu PDE/PTE settings and allocates with memdescTagAlloc (internal heap, top-down) |
[S] gpu_vaspace.c:245-260, gmmu_walk.c:138-342; [T] below |
| 3 | reusemappingdbInit(&bar1.reuseDb, ..., _kbusInternalBar1Map, _kbusInternalBar1Unmap), mapInit(mappingFlagsMap), mapInit(reverseMap) (closed: _nv043257rm(kbus+0x658.., 0x38), (kbus+0x678.., 8)) |
[D]+[S] |
| 4 | VA heap: eheapSetAllocRange(heap, 0, apertureLength - 1 - 0x1000); bar1.mappableLength (+0x5d8) = that limit. Assert apertureLength <= kbusGetPciBarSize(1) |
[D]+[S] |
| 5 | PF only, if bPreserveBar1Console (KernelBus+0xacba): map the console memdesc at BAR1 offset 0 with flags 0x460 (UNICAST, OFFSET_FIXED, PAGE_SIZE_4K). Not taken on a headless V100 |
[D]; [I] for "not taken" |
| 6 | P2P write mailbox: unless pcieP2PType == BAR1 (KernelBif+0x350 == 1), both P2P read and write disabled (KernelBif+0x331, +0x332), VF, or client-allocated mailbox (KernelBus+0xacb1): KernelBus+0x1f0 _nv039280rm (kbusAllocP2PMailboxBar1_GM200): vaspaceAlloc(bar1 VAS, size 64 KiB x 8 peers = 0x80000, align 64 KiB, ...). This is a VA reservation only |
[D] condition; [S] kern_bus_gm200.c:875; [T]: the first low BAR1 mapping lands at 0x80000 (5.3) |
| 7 | Static BAR1: KernelBus+0x2c0 _nv039488rm and +0x2c8 _nv039382rm are stubs returning 0x56 on GV100: not supported, dynamic mappings only |
[D] (13-line bodies) |
| 8 | KernelBus+0x498 _nv039293rm = kbusBar1InstBlkVasUpdate_GM107 (5.2) |
[A] |
| 9 | KernelBus+0x198 _nv039512rm (kbusPatchBar1Pdb): returns 0 |
[D] |
| 10 | Copy mailbox address/size to SLI children (no-op on one GPU). On failure kbusDestroyBar1_HAL |
[D]+[S] |
5.2 Instance block and bind: _nv039293rm and _nv039290rm [A]
_nv039293rm [A, all call targets and constants read]: pVAS = (*KernelBus+0x490)() (kbusGetBar1VASpace);
vgpuGetCallingContextGfid (_nv060459rm); skipped entirely for a virtual GPU without SR-IOV; for a VF without an
instance block it allocates one (4 KiB, tag 0x63) and records instBlockBase (+0x5f0); then, in order:
_nv040832rm(pKernelGmmu = GPU+0x1f90, bar1.pInstBlkMemDesc = KernelBus+0x5f8 + gfid*0x100, pVAS, 0xffffffff (FIFO_PDB_IDX_BASE), ¶ms{0})=kgmmuInstBlkInit;(*KernelBus+0x4a8)(gpu, kbus, 1)=kbusFlush_HAL(BUS_FLUSH_VIDEO_MEMORY)(_nv039391rm-> per GPU KernelBus+0x390);_nv039553rm=kbusSendSysmembar(per GPU KernelBus+0x398);(*KernelBus+0x4e8)(gpu, kbus)=_nv039290rm=kbusBar1InstBlkBind_GM107.
_nv039290rm [A]: aperture = _nv040817rm(pKernelGmmu, bar1[PF].pInstBlkMemDesc) (kgmmuGetMemAperture): 1 ->
target 0 (video memory), 3 -> 0x30000000 (system non-coherent), 4 -> 0x20000000 (system coherent), anything
else -> status 0x40. WR32(0x1704, ((instBlockBase >> 12) & 0x0fffffff) | target | 0x80000000); _nv049631rm
(osFlushCpuWriteCombineBuffer); if GPU+0x917, the word at GPU+0x918 or GPU+0x926 is set (reset/lost state) return
0 without polling; else timeout init (_nv059509rm) and loop RD32(0x1710) until (value & 3) == 0
(BAR1_PENDING bit 0, BAR1_OUTSTANDING bit 1), calling _nv059505rm (timeout check, line tag 0x1b8a) and
_nv049819rm (spin) between reads; when the timeout check has returned 0x65 and the bits are still set: return 0x65.
Transcript of the whole BAR1 creation on b3 (BAR1 aperture 32 GiB):
| Time (217520.x) / line | Access | Meaning |
|---|---|---|
| .543671 | U BAR2 0xfaf280, 8 bytes |
BAR2 PTE for BAR2 VA 0x250000 (BAR2 page-table array is visible at BAR2 VA 0xfae000; entry index = VA >> 12) |
| 165442-165446 | R 0x100c80; W 0x100cb8 = 0x7fffa20; W 0x100cec = 0; W 0x100cbc = 0x80000005; R 0x100c80 | TLB invalidate of the BAR2 space (PDB 0x7fffa2000) |
| .543701-.551714 | Z BAR2 0x250000 x4096, then x32 |
new page zeroed = BAR1 PD3 (root); its 4 entries (32 bytes) cleared again |
| .576145-.584367 | U 0xfaf288; invalidate BAR2; Z 0x251000 x4096; U 0x250000 8 bytes |
BAR1 PD2 page; PD3[0] -> PD2 |
| .607549-.616710 | U 0xfaf290; invalidate BAR2; Z 0x252000 x4096; U 0x251000 8 bytes; U 0x252000 512 bytes |
BAR1 PD1 page; PD2[0] -> PD1; PD1[0..63] written (64 x 512 MiB = 32 GiB: the sparse fill of mmuWalkSparsify) |
| 165457-165461 (.644124) | R 0x100c80; W 0x100cb8 = 0x7fdf770; W 0x100cec = 0; W 0x100cbc = 0x80000005; R 0x100c80 | TLB invalidate of the BAR1 space: BAR1 PDB = 0x7fdf77000 (internal heap), aperture video |
| .644140 | BAR2 W8 0x208 = 0x7_ffffffff | instance block (BAR2 VA 0 = physical 0x7fffa0000): ADR_LIMIT_LO = 0xffffffff, ADR_LIMIT_HI = 7 -> limit 0x7ffffffff = apertureLength - 1 |
| .644142 | BAR2 W4 0x204 = 7 | PAGE_DIR_BASE_HI |
| .644143 | BAR2 W4 0x200 = 0xfdf77c00 | PAGE_DIR_BASE_LO 0xfdf77 (bits 31:12), bit 11 BIG_PAGE_SIZE_64KB, bit 10 (version-2 page table format), VOL 0, TARGET 0 (video) |
| .644147-.644153 | 3 x BAR2 R 0xfa9000 | flush reads of the persistent BAR2 flush page |
| 165462-165463 | W 0x070000 = 1; R 0x070000 = 0 | kbusFlushSingle (NV_UFLUSH_FB_FLUSH): write 1, poll bit 0 clear |
| 165464 | W 0x1704 = 0x807fffa0 | bind: mode virtual, target video, PTR = 0x7fffa0000 >> 12 |
| 165465 | R 0x1710 = 0 | bind status: done at first read |
Notes: (1) only words 0x200-0x20c of the instance block are written; no zero fill of the block is visible in this
window [T], so its other words keep whatever the reserved region held. (2) 0x1704 is written exactly once in the
whole transcript (grep); there is no unbind before the end of the capture. (3) 0x100cbc 0x80000005 = TRIGGER (31) |
ALL_VA (0) | HUBTLB_ONLY (2) [S field names in dev_fb.h]. (4) The PDE and sparse values themselves went through
rep movsb and are not in the transcript; their formats are those of memory.md 3.5 [S]+[E for BAR2].
(5) Physical addresses of BAR1 PD2/PD1 were not observed (only the root is, through 0x100cb8); with a top-down
internal heap they are expected just below the root [I].
5.3 Client mapping of a video memory object: kbusMapFbAperture_GM107 [S kern_bus_gm107.c:3018]
Closed symbol not established (KernelBus HAL slot not identified in this task; open question 3). Path:
memMap_IMPL -> kbusMapFbAperture_HAL(pMemDesc, range(offset, length), &memArea, flags, pDevice).
5.3.1 Address space decision (kbusGetEffectiveAddressSpace_GM107, kern_bus_gm107.c:6379) [S]
FBMEM descriptor -> ADDR_FBMEM. SYSMEM descriptor -> ADDR_SYSMEM when direct mapping is allowed
(kbusIsDirectMappingAllowed_HAL; true for ordinary Linux system memory) or the flags ask for MAPPING_DIRECT;
otherwise reflected through BAR1 (ADDR_FBMEM), and with reflected access disallowed: 0x56. MAP_SYSCOH_OVER_BAR1
descriptors are always FBMEM. The workload's replies (1 for 0x3e, 2 for 0x40) agree [O].
5.3.2 Steps
| # | Step | Detail |
|---|---|---|
| 1 | Root descriptor | if the sub-descriptor has the same PTE kind as its root, map the root with range.start += submemOffset |
| 2 | Static BAR1 | kbusGetStaticFbAperture_HAL -> 0x56 on GV100, continue |
| 3 | Lock assert | device GPU lock owned, else 0x2f |
| 4 | Bookkeeping | mappingFlagsMap[pMemDesc] -> submap keyed by `(flags & {RSVD_BAR1, DISABLE_ENCRYPTION, MAP_DOWNWARDS, READ_ONLY, WRITE_ONLY}) |
| 5 | Reuse database | user mappings carry ALLOW_DISCONTIG: first reusemappingdbMap(reuseDb, type, range, pMemArea, SINGLE_RANGE) (an existing BAR1 mapping of the same physical range and flags is reused and reference counted); if that fails, reusemappingdbMap(..., flags = 0 for discontiguous), which may return several BAR1 ranges and halves the chunk size (page aligned) whenever a VA allocation fails (_kbusInternalBar1Map). pMemArea->pRanges is allocated by the database and freed by unmap |
| 6 | Each new chunk: _kbusMapAperture_GM107 |
memdescCreateSubMem(parent, offset, length); dmaAllocMapping_HAL(pGpu, pDma, bar1 VAS, subMemDesc, &vaOffset, dmaFlags, 0, NULL, swizzId); sub-descriptor destroyed; reverseMap[va] = type |
| 7 | dmaFlags (kbusConvertBusMapFlagsToDmaFlags) |
DMA_UNICAST_REUSE_ALLOC = FALSE; CACHE_SNOOP_ENABLE if the descriptor's CPU cache attribute is CACHED; DMA_OFFSET_GROWS_DOWN for MAP_DOWNWARDS; ACCESS_READ_ONLY/WRITE_ONLY; DMA_OFFSET_FIXED and explicit page size only when the bus flags ask (client maps do not) |
5.3.3 dmaAllocMapping_GM107 for the BAR1 space [S virt_mem_allocator_gm107.c:319]
| Item | Rule | Value for the workload's 2 MiB object |
|---|---|---|
| Page size | default page-size flag, non-system memory: memdescGetPageSize(subMemDesc) (inherited from the object); lowered to the physical page size if the mapping is not aligned to it; lowered to 64 KiB only when bBar1Force64KBMapping (true only when PCI BAR1 <= 256 MiB or by registry RM64KBBar1Mappings; false on a 32 GiB V100) |
2 MiB (the object was allocated with 2 MiB pages: attr 0x11800000) [S]+[I: closed page-size choice not traced for this call] |
| VA size / alignment | vaAlign = max(pageSize, compression alignment, BAR1: vaspace big page size 64 KiB); vaSize = ALIGN_UP(mapLength, vaAlign); mapLength = ALIGN_UP(physOffsetInPage + size, pageSize) |
2 MiB, aligned 2 MiB |
| VA range | whole BAR1 space [vaStart, vaLimit], further limited by the heap alloc range [0, apertureLength - 0x1001] |
|
| Direction | allocFlags.bReverse = DMA_OFFSET_GROWS_DOWN: bottom-up (lowest fitting address) unless the caller asked MAP_DOWNWARDS. Client maps are bottom-up; the preallocated USERD is top-down |
first free 2 MiB-aligned VA; 0x400000 in the capture [O] |
| Page size lock | vaspaceAlloc(..., pageSizeLockMask = pageSize, ...) |
2 MiB |
| PTE fill | dmaUpdateVASpace_HAL -> mmuWalkMap over [vaLo, vaHi]: one 2 MiB PTE in PD0 per 2 MiB (16-byte PD0 slot), aperture video, volatile off, read-only/priv bits from flags, kind from the descriptor (pitch) |
PD0 index = (va >> 21) & 0xff under PD1[va >> 29] |
| Missing levels | allocated on demand from the internal heap (4 KiB page per PD0; 64 KiB-page tables are 256 bytes, 4 KiB-page tables 4 KiB), zero-filled through BAR2, parent PDE written, unused entries of the new level initialised | [T] 5.3.4 |
| After PTE writes | TLB invalidate of the BAR1 PDB, then kbusFlush |
[T] 5.3.4 |
| Result | *pVaddr = vaLo + (physical address & (pageSize - 1)) |
BAR1 offset; memMap adds gpumgrGetGpuPhysFbAddr (PCI BAR1 base) for the OS side only |
So the returned pLinearAddress 0x39a000400000 = PCI BAR1 base 0x39a000000000 + BAR1 VA 0x400000 [O]+[S].
The value is opaque to libcuda (it only passes it to 0x5e); nothing in the workload depends on the exact VA.
What occupies [0x200000, 0x400000) on the captured boot was not determined (open question 4).
5.3.4 What a mapping looks like on the wire [T] (kernel mappings of the same boot; client mappings are not in the transcript)
First low mapping, a 64 KiB kernel-channel USERD at BAR1 VA 0x80000 (times 217521.x):
| Time / line | Access | Meaning |
|---|---|---|
| .635318 | U BAR2 0x252000, 8 bytes |
PD1[0] -> new PD0 page (seen at BAR2 VA 0x260000) |
| .650122; BAR0 W 0x100cb8 = 0x7fffa20, 0x100cbc = 0x80000005 | U 0xfaf308 + BAR2 invalidate |
BAR2 mapping of the page that holds the 256-byte 64 KiB page table (BAR2 VA 0x261d00) |
| .650156 | Z 0x261d00 x256 |
page table zeroed (32 entries x 8 bytes) |
| .650750 | U 0x260000, 16 bytes |
PD0[0] (dual entry: pointer to the 64 KiB table) |
| .650784, .650908 | U 0x261d00 64 bytes; U 0x261d48 184 bytes |
entries 0..7 and 9..31 (the neighbours of the mapped page) |
| .651257 | U 0x260010, 4080 bytes |
PD0[1..255] initialised |
| .658956 | U 0x261d40, 8 bytes |
PTE 8 = VA 0x80000 |
| BAR0 .658980-.658989 | R 0x100c80; W 0x100cb8 = 0x7fdf770; W 0x100cec = 0; W 0x100cbc = 0x800000c5; R 0x100c80 | invalidate BAR1 PDB: TRIGGER, ALL_VA, HUBTLB_ONLY plus bits 7 (ACK field 8:7 = 1 GLOBALLY) and 6 |
| BAR0 .658991-.658999 | W 0x070000 = 1; R = 0; W 0x070000 = 1; R = 0 | two flushes |
The kernel then uses it: BAR1 W4 offset 0x9008c (USERD GP_PUT of kernel channel 1, mapped at 0x90000) at
217522.812877. The 0x80000 start equals the size of the P2P mailbox reservation [0, 0x80000) [S constants]+[I].
5.3.5 Unmap: kbusUnmapFbAperture_GM107 [S kern_bus_gm107.c:3213]
reverseMap[memArea.pRanges[0].start] -> mapping type (missing -> 0x40); for each range reusemappingdbUnmap
(drops a reference; at zero _kbusInternalBar1Unmap: memdescFlushCpuCaches, dmaFreeMapping_HAL(bar1 VAS, va, pMemDesc, 0, NULL) = PTEs invalidated, TLB invalidate, VA range returned to the heap; lower page-table levels are
released by the walker when empty); refCount--, maps cleaned up; portMemFree(memArea.pRanges). The
VASPACE_FLAGS_BAR free path first calls kbusFlush_HAL(VIDEO | SYSTEM) (gpu_vaspace.c:1748). Register-level
sequence of an unmap was not extracted from the transcript in this task (open question 5).
5.4 USERD and BAR1
| Topic | Finding | Evidence |
|---|---|---|
Preallocated USERD (kfifoPreAllocUserD_GM107, closed _nv040366rm) |
userdSize (0x200) x numChannels (4096) = 2 MiB of video memory, descriptor page size forced to 4 KiB, mapped with `BUS_MAP_FB_FLAGS_MAP_DOWNWARDS |
MAP_UNICAST |
0x2254 (kfifoSetupBar1UserdSnoop_GM107, closed _nv040417rm) |
`0x10000000 | (BAR1 VA >> 12): line 167137 W 0x2254 = 0x107ffdf0. Earlier writes 140934 (0x10000000) and 141004 (0`) belong to the FIFO load/unload inside the ACR bootstrap, before BAR1 exists |
| Kernel-owned channels | their USERD (64 KiB objects at 0x7eee20000..) is CPU-mapped through BAR1 at 0x80000, 0x90000, 0xa0000 and written there (GP_PUT at +0x8c) |
[T] BAR1 events; fifo.md 3.5 |
Client channel with hUserdMemory (the workload) |
kchannelCreateUserdMemDescBc_GV100 -> kchannelCreateUserdMemDesc_GV100: only builds a 0x200-byte sub-descriptor at userdOffset of the client's Memory object (page size temporarily 4 KiB), checks MEMDESC_ALLOC_FLAGS_PROTECTED (0x29), address width (0x1e) and alignment (0x1e), sets bClientAllocatedUserD. No kernel BAR1 mapping is created; kchannelMap_IMPL and kchannelUnmap_IMPL return NV_ERR_INVALID_REQUEST (0x3f) for such a channel and kchannelMapUserD returns OK without mapping |
[S] kernel_channel_gv100.c:69-283, kernel_channel.c:1329,1393,4286 |
| Consequence | the physical address and aperture of the client USERD go into RAMFC and the runlist entry; the client writes GP_PUT through its own BAR1 mmap of the 2 MiB 0x40 object and rings 0x810090. BAR1 is therefore on the workload's critical path even though the kernel never touches the client USERD through it. The snoop base 0x2254 covers only the preallocated block, which the workload's channels do not use |
[S]+[O]; [I] for "critical path" (the alternative, USERD in system memory, is a client decision) |
| Whether the monolithic physical side zeroes or reads the client USERD at channel setup, and through which aperture | not established | open question 6 |
5.5 Checklist: "BAR1 bring-up level" (after BAR2 level 4, before FIFO PostLoad)
Inputs: PCI BAR1 CPU base and size (b3: 32 GiB); reserved-region base = BAR1 instance block address
(b3: 0x7fffa0000; BAR2's block is the next page, bind value 0xc07fffa1 at line 138314); a working BAR2 (or
PRAMIN) path to write framebuffer pages; the internal heap allocator (mmu/placement.rs) for page-table pages;
GMMU version-2 entry encoders (mmu/bar2_setup.rs).
| # | Action | Register / memory writes | Success criterion |
|---|---|---|---|
| 1 | Allocate 3 x 4 KiB from the internal heap: PD3, PD2, PD1 | zero each page (through BAR2/PRAMIN) | pages read back zero |
| 2 | Link and sparsify | PD3[0] = PDE(PD2), PD2[0] = PDE(PD1), PD1[0..n-1] = sparse entry, n = apertureLength / 512 MiB (64) | entry formats as BAR2 level; on b3 PD3 = 0x7fdf77000 |
| 3 | TLB invalidate for the new PDB | R 0x100c80; W 0x100cb8 = (PDB >> 12) << 4; W 0x100cec = 0; W 0x100cbc = 0x80000005; R 0x100c80. The transcript shows no read of 0x100cbc: the only reads are 0x100c80 before and after (value 0x208001 both times), so completion is judged on 0x100c80 as in the BAR2 level [T]; which bit is tested was not re-read here | b3: 0x100cb8 = 0x7fdf770 |
| 4 | Instance block words | +0x208 = 0xffffffff, +0x20c = (limit >> 32) (b3: 7), +0x204 = PDB >> 32 (7), +0x200 = (PDB & 0xfffff000) | 0xc00 (b3: 0xfdf77c00), in this order |
| 5 | Flush | read the BAR2 flush page; W 0x070000 = 1; poll R 0x070000 bit 0 == 0 | b3: first read 0 |
| 6 | Bind | W 0x1704 = 0x80000000 | (instBlock >> 12) (b3: 0x807fffa0); poll R 0x1710 & 3 == 0, timeout as gpuSetTimeout default |
| 7 | Reserve BAR1 VA [0, 0x80000) (mailbox) if exact VA parity with the original is wanted |
none | - |
| 8 | Self-test (not done by the original; recommended [I]): map one internal-heap page with a 4 KiB or 64 KiB PTE, write a pattern through BAR2, read it through the BAR1 CPU mapping, unmap | page-table writes + invalidate (0x100cbc = 0x800000c5) + two flushes as 5.3.4 | pattern equal; no MMU fault interrupt pending |
| 9 | FIFO PostLoad: preallocated USERD at the top (5.4), then `W 0x2254 = 0x10000000 | (va >> 12)` | 512 PTEs of 4 KiB |
| 10 | Per client map of a 0x40 object: VA = lowest free, aligned max(page size, 64 KiB); PD0 2 MiB PTE(s) (or 64 KiB / 4 KiB tables for smaller objects); invalidate; flush; return BAR1 base + VA; build the mmap context {memArea = [BAR1 base + VA, len], access_start, access_size = 4 KiB, prot 3, caching 2} |
5.3.3 | user process reads/writes the object |
| 11 | Per unmap / object free: invalidate the PTEs, TLB invalidate, flush, free VA and empty tables | 5.3.5 | - |
Must stay valid from bind until the last BAR1 user is gone: the instance block page, PD3/PD2/PD1 and every lower table, register 0x1704, the client PTEs for as long as a user VMA can exist (unmap ioctl or object/client free; since the user PFNs are not revoked by unmap, an implementation should zap the VMA or at least invalidate the PTEs before the physical memory is reused), the kernel USERD mappings and 0x2254 while channels exist.
Teardown [S kbusDestroyBar1_GM107; no transcript of an unload was examined]: free the mailbox VA, unmap the
console if preserved, vmmDestroyVaspace (frees all tables), destroy the reuse database and both maps,
pVAS = NULL. The public body does not rewrite 0x1704; whether the closed unload path does (and what value
a later load of the original expects to find) is open question 7. Any "restore" step of the Rust level should
therefore be: stop all users, clear 0x2254, and leave 0x1704 to the next owner's own bind unless the experiment of
question 7 shows otherwise [I].
6. Closed object versus public source
Read at instruction level in this task with REA procedure_assembly (shared Ghidra session, read-only):
| Closed symbol | Public name | What was confirmed at [A] | Difference from public 580.178.04 |
|---|---|---|---|
_nv054155rm |
rm_create_mmap_context with RmCreateMmapContextLocked, RmGetAllocPrivate, RmSetUserMapAccessRange, RmValidateMmapRequest inlined |
rmapiLockAcquire(2, 0x1000); serverutilAcquireClient(hClient, 0, ..) failure -> 0x23; RmClient+0x118 (ProcID) vs osGetCurrentProcess -> 0x23; rmGpuLocksAcquire(0, 0x1000); hDevice == RsClient+0x48 test, else CliSetGpuContext, else subdeviceGetByHandle; TLS slot 2 non-NULL -> release, nv_add_mapping_context_to_file(pGpu+0x9d8, tlsNvuap, prot = 3, NULL, pageIndex 0, fd); otherwise os_alloc_mem(0x50) + os_alloc_mem(0x10), fields +0 addr, +8 size, +0x10 offset (page-aligned down), +0x28 pRanges {start = addr & ~mask, size = ALIGN_UP(size + in-page offset)}, +0x30 numRanges = 1, +0x38 access_start, +0x40 access_size, +0x48 contig = 1, +0x4c caching; BAR tests against nv+0x108 (regs), nv+0x140 (fb), nv+0xe0/0xe8 (IMEM BAR) and the coherent ranges of KernelMemorySystem (+0x458, +0x460, +0x488, +0x490, property GPU+0x91c); system branch: nv_get_ctl_state, API-lock-owner check (0x2f), clientGetResourceRef , RmResource cast (0x31), vtable +0x110 descriptor getter, flag tests 1<<32 (user read-only), 1<<31 (peer IO), Allocated byte at descriptor+0x6c, flags 0x88000000000000, flag 1<<53 (else 0x57), address space 1 or 7 (else 0x57), mem data NULL -> 0x57, os_match_mmap_offset, overflow / page-count checks -> 0x1f, prot = readOnly ? 1 : 3; BAR branch without TLS: nv_check_usermap_access_params, osIsAdministrator -> prot 3, else internal control 0x20800198 (0x18 bytes) on nv+0x2e0 / nv+0x2e8; cleanup frees pRanges then the block; rmGpuLocksRelease(0, 0); client release; API lock release |
none found |
_nv054198rm |
rm_update_device_mapping_info + RmUpdateDeviceMappingInfo |
rmapiLockAcquire(2, 0x80000); serverAcquireClient(&g_resServ, hClient, 1, ..); deviceGetByHandle then subdeviceGetByHandle; rmGpuGroupLockAcquire(inst, group 1 device / 0 subdevice, 0, 0x80000, &mask); clientGetResourceRef(hMemory); three objDynamicCastById class ids (0x4789f2, 0x3abed3, 0x5d8d70), none -> 0x33; refFindCpuMappingWithFilter(ref, old, filter 0x6217ef0); mov [mapping + 0x18], new (RsCpuMapping.pLinearAddress); releases |
none found |
_nv019591rm |
cliresCtrlCmdClientGetAddrSpaceType_IMPL |
params +0 hObject, +4 mapFlags, +8 out; Memory cast -> vtable +0x1b8 (memGetMapAddrSpace), else GpuResource cast -> vtable +0x1d8 (gpuresGetMapAddrSpace), else 0x31; internal address space -> reply: 1 -> 1, 7 (EGM) -> 1, 2 -> 2 (4 if the object casts to FlaMemory), 3 -> 3, 6 -> 4, 8 -> 5, 4 (virtual) and all others -> reply 0 with status 0x1f |
none found |
_nv039293rm |
kbusBar1InstBlkVasUpdate_GM107 (KernelBus slot +0x498; not the register write itself) |
5.2 | none found (the allocation tag constant is 0x63 in the binary; the public name is ..._UNNAMED_TAG_66, value not compared) |
_nv039290rm |
kbusBar1InstBlkBind_GM107 (slot +0x4e8) |
5.2: register 0x1704 value, flush call, skip conditions, poll of 0x1710 with mask 3, timeout status 0x65 | the public loop breaks on timeout after logging; the closed loop returns 0x65 from inside the loop: same observable result |
Pseudocode only [D] in this task: _nv039462rm (kbusInitBar1_GM107: structure and constants agree with the
public body, including the reuse database, the two maps and the static-BAR1 probes, which are stubs on GV100),
_nv039391rm (kbusFlush_GM107), _nv039553rm (kbusSendSysmembar_IMPL), _nv039488rm, _nv039382rm,
_nv039512rm.
Not read in the closed object (public source only): serverMap/serverUnmap/memMap_IMPL/memUnmap_IMPL/
genapiMap_IMPL, kbusMapFbAperture/kbusUnmapFbAperture, dmaAllocMapping, gvaspaceAlloc, the reuse mapping
database, kchannelCreateUserdMemDesc. nv_add_mapping_context_to_file, nvidia_mmap*, nv_alloc_user_mapping
and os_match_mmap_offset are outside the closed object: they are compiled from kernel-open/, so the public
text is the implementation.
Corrections to earlier dossiers made by these notes: (a) system-memory pLinearAddress is a physical page
address, not a kernel cookie (rmapi-userspace.md 3.3); (b) _nv039293rm is the instance-block update, the bind
register write is _nv039290rm (memory.md 3.2 step 18 calls _nv039293rm the bind); (c) BAR1 vaspace flags on
the PF are 0x04080081; (d) the "kernel USERD does not use the preallocated block" inference of fifo.md is
consistent with the BAR1 layout found here (mailbox 0..0x7ffff, USERDs from 0x80000, preallocated block at the top).
Open questions
| # | Question | Experiment that settles it |
|---|---|---|
| 1 | Values of the BAR1 PDEs, sparse entries and PTEs (the transcript has only addresses and lengths of rep movsb) |
Run the original's mmuWalkSparsify/dmaAllocMapping callees in the instruction harness with a memory hook on the page-table pages (as tools/check_gpu_memory_placement_binary.py does for the heap), or capture a new mmiotrace with the string-move instructions single-stepped; compare with mmu/bar2_setup.rs encoders |
| 2 | Physical addresses of BAR1 PD2/PD1 and of later tables (only the root 0x7fdf77000 is visible through 0x100cb8) | Same harness: log the internal-heap requests made between line 165442 and 165464; or read PD3[0]/PD2[0] back through PRAMIN on the original after first open |
| 3 | Closed symbols and HAL slots of kbusMapFbAperture/kbusUnmapFbAperture, dmaAllocMapping, and whether their bodies equal the public ones (reuse database present?) |
Resolve the callee of the FBMEM branch in the closed memMap (vtable slot of Memory +?); procedure_callees on it; compare with kern_bus_gm107.c:3018 |
| 4 | Why the captured client mapping is at BAR1 VA 0x400000 (who holds 0x200000..0x3fffff; UVM channel memory is the candidate) and whether the VA matters to anything | Trace 0x4e on a single-GPU run of the original with and without nvidia-uvm users; or log BAR1 heap allocations in the harness. The notes argue it does not matter (5.3.3) |
| 5 | Register sequence of a BAR1 unmap (invalidate flags, number of flushes) | Extract from b3-bar12-rle.txt/b3-bar0.txt the window where the kernel-channel USERD mappings are released (search for zero/U writes to the tables at BAR2 0x261d40.. followed by 0x100cb8 = 0x7fdf770) |
| 6 | Does the closed physical channel setup touch a client-allocated USERD (zero fill, GP_GET read) and through which path (BAR2 mapping vs BAR1) | Read _nv019338rm/_nv019368rm/_nv040415rm/_nv040419rm for accesses to the USERD descriptor; check the transcript around a 0xc36f allocation of a client run |
| 7 | Does unload rewrite 0x1704 / 0x2254, and what state must be left for the original driver to load again | Read KernelBus Unload/PostUnload/Destroy bodies (kbusStateUnload_GM107 public: check for a 0x1704 write) and capture a transcript that includes module unload |
| 8 | Is the BAR1 instance block page cleared before words 0x200-0x20c are written (no zero run seen at BAR2 VA 0 in the bind window) | Search the transcript before line 165442 for writes to physical 0x7fffa0000 (PRAMIN window 0x7fffa or BAR2 VA 0); else zero it explicitly in the Rust level (harmless) |
| 9 | Length used by memMap bounds checks for 0x3e objects whose requested size is not page aligned (0x368d10 was mapped with length 0x368d10) |
Run Nv04MapMemory in the RM API fixture with length = size + 1 and ALIGN_UP(size); record statuses |
| 10 | Teardown order when an object with live mappings is freed (back-references through the context device) | Fixture: map, free the device first, then the object; check the mapping list and the unmap callbacks |
| 11 | nv->ud (the "UD" sub-range of BAR1) is assumed unused on GV100 |
Read nv->ud initialisation in kernel-open/nvidia/nv-pci.c/nv.c and the RM setter |