NV2080_CTRL_CMD_GPU_GET_COMPUTE_POLICY_CONFIG is a CPU-RM control, not a
physical one. In the subdevice export table its flags are 0x10b, with no
ROUTE_TO_PHYSICAL bit [A] (open-gpu-kernel-modules 620.85.02
generated/g_subdevice_nvoc.c, subdeviceCtrlCmdGpuGetComputePolicyConfig;
nvdriver's 580.178.04 control table has the same flags). nvdriver already
answers it in its own server (rmapi/gpu.rs CMD_GPU_COMPUTE_POLICY), but
gsp_route.rs forwarded it to GSP-RM on every GSP GPU.
[O] In a VFIO guest on a physical A100 PCIe 40 GB, with the GA100 bring-up
patches (sent separately) on upstream e0bcddc and the 580.178.04
userspace and GSP-RM, GSP-RM answered the control with 0x57 (two times)
and cuInit(0) returned 100. With the
control kept on the host, cuInit passed. Every CUDA parity suite check
and digest then equals a stock run; both fail only primary_ctx_ok.
This change moves the list of controls that gsp_route.rs keeps on the host
into rmapi::server::gsp_host_side_control and adds 0x20800195 to it.
The three controls that were in the list before do not change. The change
applies to all GSP GPUs (Turing to Blackwell); only the A100 was run.
A unit test checks the list and that the control has no ROUTE_TO_PHYSICAL
flag.
Co-authored-by: GrowDev1 <growdev1@users.noreply.github.com>
* rmapi/vm: fix clippy int_plus_one and EDU guest FB geometry register fixture
* tests/vm: use exact V100-SXM2-32GB FbGeometry register values in EDU fixture
---------
Co-authored-by: Eric Hartford <eric@quixi.ai>
#516 renamed the Rust export nv_rs_sysmem_pool_pop to
nv_rs_sysmem_pool_pop_batch (rmapi_node.c now calls the batch form) and
updated the module keep list in src/nvidia/Makefile, but the guest build's
copy of the list in tools/vm/build_guest_test.sh still forced the old
name with -u. ld -r then leaves nv_rs_sysmem_pool_pop as an undefined
symbol and drops the batch export, so modpost fails on nv_rs_edu_test.ko
and validate_all.sh's guest_build (and initramfs/guest/guest_iommu after
it) fail on master 3e1bf7b8.
nvidia_rs.ko is byte-identical with and without this change.
Claude-Session: https://claude.ai/code/session_01W53iUSBQkEg9aqwF4AoBHi
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* rmapi: probe pre-GSP FB/L2/bus-width geometry from BAR0 and keep VPSTATE MCLK above P8 (#631)
* rmapi: reject PRI errors on NV_FUSE_STATUS_OPT_HALF_FBPA in FbGeometry::from_registers
---------
Co-authored-by: Eric Hartford <eric@quixi.ai>
* fix(pcie): restore link target after retrain register failures
Reuse the existing best-effort timeout rollback for every failure after the endpoint target write succeeds, preserving the original error. Fault injection exposes three failing tests on master; all eight targeted tests, workspace tests, clippy and offline codegen checks pass with the correction. No changes to link policy, capability gates or success path.
* perf(uvm): batch DMA mapping cleanup at node exit
Drain up to 16 live records per leaf-mutex acquisition, preserving bucket order and leaving DMA unmap/page/device releases outside the lock. No changes to insert/lookup/device detach, per-page unmap or mapping permissions. Seven paired CPU-only samples from 1 to 262144 records show 1.30x to 20.85x faster ledger cleanup. Workspace 1409 passed, 150 ignored; clippy, formatting, native codegen and Rust kernel object build pass. Full kernel module and physical/guest testing pending.
* perf(rmapi): batch hot system-page pool reuse
Take up to 32 hot pages per pool mutex acquisition, publish the count once, and clear all reused pages outside the mutex. Preserve LIFO order, partial/empty fallback, admission and cache policy, and allocation failure cleanup. Seven paired host benchmarks show up to 4.72x faster bookkeeping and 4.92x p99 improvement for 16384 fully pooled pages, with single-page and empty-pool parity. 1409 workspace tests pass, 150 ignored; strict clippy, codegen audit, Rust kernel object and offline kernel gates pass. Full C module/guest/physical validation pending.
---------
Co-authored-by: Nick <your-email@example.com>
* ada/desktop: adapt Stage 1 & Stage 2 desktop video for RTX 40 series (AD102-AD107)
Stage 1 & Core Ada GSP-RM / RM fixes (verified against stock 580.196.07):
- ga10x_gsp.rs: stop downgrading Ada's configured 580.x release string when
no bundled 580.178.04 Ada booter exists, add 580.196.07 -> 580.178.04
gsprm_load fallback, read NV_FUSE_STATUS_OPT_DISPLAY at 0x820c04 on
Ampere/Ada+ (_nv030373rm) and propagate display_fused_off into hw facts,
and fail explicitly (instead of silently skipping) when cold-boot Ada
scrubber-580.bin is missing.
- display.rs, display_channels.rs, gsp_boot.rs, ga10x.rs: fix Ada
DispSfUser BAR0 offset (0x6f0000 for all NvDisplay v03_00+ per
_nv005909rm/_nv040109rm), fix Ada copy_engine class (0xc7b5
AMPERE_DMA_COPY_B), enable ce_class_db filtering for ArchFamily::Ada,
and pass real boot0 to configure_live_display().
- gsp_route.rs, rmapi_node.rs, modeset_ffi.rs, modeset_bridge.c: intercept
NV_ESC_RM_BIND_CONTEXT_DMA (0x59) in pre() for host-side 0x0002 ->
NvDisplay channel binds, keep modeset_gsp_alloc_ctxdma 100% host-side
with Node RM video memory lookup via nv_rs_modeset_query_rm_mem, prevent
double GSP memory registration, purge MODESET_MEMS/MODESET_CTXS on
NVOS00 free, validate Stage 1 nv_rs_modeset_get_rm_ops against the
configured 580.x driver_version, and fix NVOS64 debug status trace.
Stage 2 Ada NvDisplay v4.1 (0xc77d/0xc67e) & DRM pipeline fixes:
- nvidia_rs_modeset.c:
- Separate full Core modeset/link-training from fast Window-only page
flips and cursor-only Core updates; program Core FIRST on full modeset.
- Resolve imported compositor/Vulkan/EGL VRAM handles via
nv_rs_modeset_query_rm_mem and bind host-side NV01_CONTEXT_DMA to Core
and Window channels for scanout.
- Enforce BAR1 window bounds on 0x0040 allocations (falling back to
BAR1-constrained nv_rs_modeset_vram_alloc on non-ReBAR 256 MiB GPUs)
and propagate block-linear pte_kind.
- Query NV0073_CTRL_CMD_SPECIFIC_OR_GET_INFO (0x0073028b) for SOR
sublink A/B (DP_A/DP_B, SINGLE_TMDS_A/B, DUAL_TMDS), promote HDMI
>600 MHz to SOR_PROTOCOL_HDMI_FRL (0xc), bracket DP link training with
NV5070_CTRL_CMD_SET_SOR_FLUSH_MODE (0x50700457), support DP 1.4a HBR3
(0x1e) via DP_GET_CAPS (0x00731369), and retry with FALLBACK_CONFIG.
- Honor HSYNC/VSYNC polarity and 10 bpc depth in HEAD_SET_CONTROL_OR,
emit HEAD_SET_CONTROL / PCLK_CFG / USAGE_BOUNDS / STORAGE_CURSOR,
fix WIN_SET_PLANAR_STRG0 13-bit mask (& 0x1fff), add XBGR16161616F,
and back off synthetic vblank timer when real HW vblank IRQs arrive
(removing the 4 ms floor for 240/360 Hz displays).
- nvidia_rs_drm.c: fix VRAM BAR1 mmap vma->vm_pgoff bounds/offset,
validate explicit FB modifiers and reject compressible modifiers, add
XBGR16161616F, remove unimplemented NV12, set preferred_depth=24 and
<6.13 allow_fb_modifiers=true, and pair drm_kms_helper_poll_init/fini.
- install_desktop_boot.sh, reload_stage1.sh: add Ada (ad102) GSP boot &
scrubber firmware preflight check with extract_gsp_boot_ucode.py hint.
- Add unit tests in display.rs, gsp_boot.rs, nvdisp_pushbuf.rs, and
gpu_tests.rs covering Ada classes, fuse register, and pushbuffer encode.
* ada/desktop: resolve all CodeRabbit review findings for RTX 40 desktop video
* ada/desktop: address round-2 CodeRabbit review findings
* ada/desktop: address final CodeRabbit review findings
* ada/desktop: track explicit fb modifiers, order disable before vblank_off, reserve Window room up front
---------
Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com>
* gv100: fall back to PMU VBIOS power telemetry when baseboard INA3221 is absent (#484)
* gv100: gate automatic VBIOS capture on stopped/halted PMU CPUCTL
* gv100: log when PMU power fallback is skipped due to unavailable VBIOS capture
---------
Co-authored-by: Eric Hartford <eric@quixi.ai>
* gv11b_acr: split LSB vs BL-desc sizes, accept variable-length netlist regions
Audit of the feat/arm64-xavier-gv11b silicon commits (40ed53fa, e308dae4,
2bf9846c) against nvgpu L4T R36.5 as summarized in
nouveau-gv11b/analysis/01-acr-secboot-falcon.md [A]:
- lsb_header_v1 tail: lsf_gen_wpr_requirements overrides the non-PMU
app_code_size = ucode_size - bl_code_size and app_data_size = data_size,
i.e. 256-B aligned for FECS as well. Upstream wrote raw FECS sizes here
(2bf9846c was right on this point).
- flcn_bl_dmem_desc_v2: non_sec_code_size / data_size come from
app_resident_{code,data}_size, which is raw for FECS and 256-B aligned for
GPCCS. 2bf9846c rounded FECS to 4 B, which nvgpu does not do; keep the
upstream resident() semantics and apply them only to the BL descriptor.
- flcn_acr_desc_v1.wpr_region_id: nvgpu GV11B writes only blob start/size,
no_regions = 1 and wpr_offset = 0. e308dae4 forced 1 (dGPU gm200 style),
2bf9846c forced 0; neither matches, so the field stays untouched (the L4T
images ship a zeroed descriptor). Documented and asserted.
- Netlist inst/data regions are not word multiples on real images (40ed53fa
relaxed inst only); accept any non-empty u32-sized inst and data.
- New validate_nonwpr_blob(): non-WPR sysmem blob must be non-empty, in the
40-bit DMA window, no larger than WPR1 and disjoint from the
firmware-locked WPR1.
Host unit tests only; nothing here has run on GV11B silicon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* gv11b_bringup: plan Stage 3-6 levels and the fuse-selected ACR path
Adds pure planning helpers for the secure half of Tegra194 bring-up:
- Gv11bLevel 0..=6 (cumulative), extending the branch's 0-5 ladder with
level 6 = FECS/GPCCS cpuctl_alias start + ctxsw handshake
(gv11b_gr::start_fecs_gpccs_and_handshake). Out-of-range levels are
rejected, not clamped.
- plan_acr_path(): priv_sec_en == 0 selects the non-secure path; with
priv_sec_en fused, WPR1 from 0x100cd4 must be programmed
(MissingWpr1 otherwise, as nvgpu fails with -EINVAL) and pass the
128 KiB / 40-bit sysmem WPR checks.
- level_action(): skips only the PMU HS ACR level on the non-secure path.
Host unit tests only; no hardware touched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fifo/load: take the runlist buffer aperture from its descriptor (GV11B sysmem)
`load::submit` (OBJFIFO+3b0 _nv028192rm -> _nv028190rm -> +3b8 _nv028203rm)
built its context descriptor with a hardcoded framebuffer address space
(+70 = 2, +7c = 0), so a runlist buffer allocated in system memory -- the
only kind a zero-FB GPU such as GV11B (0x150:0xb, 40-bit sysmem) has --
would have been programmed into 0x2270 with the VID aperture (0) instead
of SYS coherent (2) / non-coherent (3).
`load::Buffers` now carries the descriptors' address space and coherency,
and `stop_runlist` passes them through to `context::Command::new`, whose
address-space -> aperture mapping and 40-bit bound are the existing
[A]/[E]-verified _nv028190rm leaf. `Buffers::at_init` keeps the traced
GV100 framebuffer descriptors, so the GV100 oracle/transcript paths and
`kernel/fifo_bringup.rs` are unchanged; `Buffers::at_init_in` takes the
caller's actual allocation's values.
Evidence: host unit tests only ([E]-style model). No REA session, QEMU
guest or silicon run was performed for GV11B; which address space the
original allocates runlist buffers in on a zero-FB GPU is not derived here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fifo/load: validate descriptor before acquiring LPWR reference
* test(fifo): enable LPWR engine mask bit in descriptor rejection ordering test
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
_nv057446rm returns NOT_SUPPORTED for a GPU whose bus type (GPU+0x200)
is not 3 (PCI Express); this was recorded in the module doc but not
modelled. Add gpu_atomics_on_bus(bus_type, ..) carrying that gate and
keep supported_gpu_atomics as its PCIe case, so existing callers are
unchanged. An integrated GPU off PCIe (GV11B on Tegra194) is refused
whatever non-3 value it holds. Not wired: rmapi::gpu does not yet
model GPU+0x200.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
GV11B fell through arch_clock_defaults to the Tesla V100 1290/1530 MHz
GPCCLK and 877.5 MHz HBM2 values. Xavier has no VBIOS P-state table;
BPMP owns GPCCLK and EMC.
Base and boost GPCCLK are now the BPMP OPP ceilings of the default and
maximum nvpmodel envelopes (gv11b_dvfs::max_gpcclk_for_power_mw over
nvml_ctrl::GV11B_PWR_LIMITS), i.e. 675.75 / 905.25 MHz. The MCLK default
is 0 (unknown) instead of a borrowed HBM2 clock, which the clock-info
handler already reports as NOT_SUPPORTED until a live reading arrives.
arch_clock_defaults and GpuFacts::new drop `const` so the existing
non-const DVFS helper is reused rather than duplicated.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
nv_rs_rmapi_register_external_sgt() (GEM_EXPORT_DMABUF_MEMORY bridge,
#587) copied the importer's sg_dma_address() values verbatim into
external_dma_addrs[], which page_dma/page_dma_batch hand straight to
GPU sysmem PTEs. Nothing checked them against the GPU's addressing
width, so on GV11B (dma_bits = 40, platform_driver.c) a scatterlist
mapped for a different/wider device would be silently truncated by
the MMU. Refuse any segment ending past DMA_BIT_MASK(dma_bits) with
-EINVAL, before the RM object is created (caller keeps ownership).
Also derive page_dma_batch's renegotiation width from
nv_rs_rmapi_gpu_dma_bits() like page_dma does instead of a literal 47
(no behaviour change: negotiate already clamps to the node's width).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Add nv_rs_dma_context_create_dev(struct device *, bits, **) and
LinuxDma::from_device so Tegra194 GV11B platform GPUs, which have no
nv_rs_pci lease, can own a coherent DMA context.
ctx->pci is now optional. Creation, close and force_close share
context_init/context_destroy/context_release_owner: a PCI-owned context
releases its DMA user count and PCI reference exactly as before, a
device-owned context drops its get_device() reference with put_device().
Removal checks go through context_removed(), which consults
nv_rs_pci_is_removed only when ctx->pci is set. The PCI path keeps its
check order and errno values (-EINVAL, -ENODEV, -ERANGE, -ENOMEM).
The dma-mock fixture models get_device/put_device and covers the
device-owned lifecycle, every create failure path, force_close, and
independence from PCI removal state.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
[T] Observed live on physical silicon (Tesla P100 SXM2, host-native
nvidia_rs lanes, kernel 6.12.105, driver 8f5bf596):
do_namespace() reads /proc/<getppid()>/ns/mnt unconditionally. When the
launcher is started through a container-runtime or supervisor chain
(incus exec, docker exec, systemd wrappers) the spawning process can
already be gone or invisible in the PID namespace, getppid() reports
pid 0, and the readlink aborts the launcher with:
FileNotFoundError: [Errno 2] No such file or directory: '/proc/0/ns/mnt'
before any mount step runs. This reproduced on every lane start in that
setup until the guard was made tolerant.
Fix: fall back to the namespace init's mount ns (/proc/1/ns/mnt), which
is the original mount namespace the app process must diverge from, and
if even that link is unreadable (hidepid / ptrace checks under a
non-root test run) degrade to the self-comparison alone. The guard
stays fail-closed in all three paths: if unshare() did not create a
private namespace, now == before still aborts.
Verification (both on the patch, python 3.12):
- non-root, getppid() -> 0: launcher now passes the guard and stops at
unshare(CLONE_NEWNS) EPERM (was: FileNotFoundError crash at the guard)
- root, getppid() -> 0: do_namespace() completes, in_private_namespace
True, ns id differs from before (guard + unshare + check all work)
- unchanged behavior when getppid()'s ns is readable (first path taken)
Signed-off-by: Patrick Hamid <phamid@users.noreply.github.com>
Co-authored-by: Patrick Hamid <phamid@users.noreply.github.com>
nv_rs_runtime_park_wait() currently sleeps with wait_event_timeout(), which puts each GPU's long-lived nvidia_rs_rtN worker into TASK_UNINTERRUPTIBLE (D state) for its entire parked lifetime. That permanently adds +1.00 per GPU to system load average and causes D-state hang checks (such as tools/gpu_binding.py) to flag an idle worker unless explicitly exempted.
Switch to wait_event_idle_timeout(), which sleeps in TASK_IDLE (TASK_UNINTERRUPTIBLE | TASK_NOLOAD):
- identical wake_up() and signal-ignoring semantics;
- displays as I (idle kthread) instead of D and adds 0 to load average;
- available in <linux/wait.h> since Linux 4.15 (well below the 5.15+ compat floor in docs/KERNEL_COMPAT.md).
Co-authored-by: Arsenova <arsenova@a7snv.com>
GV11B_PWR_LIMITS repeated the 10 W / 30 W Xavier bounds already defined
in gpu::gv11b_dvfs. Take min/max from GV11B_POWER_MIN_MW/MAX_MW so the RM
power-policy envelope and the hwmon power cap cannot drift, name the
15 W nvpmodel default, and replace the 0x150/0xb literals with an
is_gv11b_arch() helper. Adds a test tying the envelope to the dvfs
hwmon clamp and OPP ceilings.
No RM control ABI changes: clock-domain, P-state and VPState tables stay
GV100 captures because no 580.178.04 REA evidence exists for a GV11B
layout (Tegra GV11B is not driven by nv-kernel.o).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
register_live_gv100 always kept UvmGpuDescriptor's fixed 47-bit
dma_addressable_limit, so nvUvmInterfaceRegisterGpu would report a 47-bit
range for the GV11B platform GPU, which rmapi_node.c records as 40 bits
(platform_driver.c dma_bits, or nv_rs_uvm_dma_bits_for_boot0 -> 40 for
arch 0x150).
Read the width back through the existing nv_rs_rmapi_gpu_dma_bits(gpu_id)
and turn it into a limit; a width outside 32..=64 keeps the default.
PCI GPUs leave desc.dma_bits 0, so they resolve to the boot0 value (47
for GV100/Pascal/Maxwell): unchanged behavior there.
Evidence: [A] in-repo only (va_space.rs dma_bits_for_arch, rmapi_node.c
node->dma_bits, platform_driver.c). No closed-580 REA performed, no
hardware run. No Makefile change: the new callee is a C symbol.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
share_check (behind dup_resource and may_share) now calls may_share_from
after its object lookup instead of repeating the rules, so the GSP-RM
forwarding gate and the local dup path cannot drift apart. Error order
is unchanged: OBJECT_NOT_FOUND before INSUFFICIENT_PERMISSIONS.
Follow-up to #337 (Greptile P2).
* fix(rmapi): answer NV2080_CTRL_CMD_BUS_GET_PCI_INFO_V2 (0x2080183c) on pre-GSP GPUs (#564)
580.196.07 nvidia-smi / NVML asks for 0x2080183c when it reports
pci.bus_id. It is not in the 580.178.04 export table that control_table.rs
is generated from, so a pre-GSP GPU refused it with NV_ERR_NOT_SUPPORTED
(0x56) and `nvidia-smi --query-gpu=pci.bus_id` printed [N/A]. 580.178.04
userspace never sends it, which is why this went unseen.
The 28-byte layout is NV2080_CTRL_BUS_GET_PCI_INFO_V2_PARAMS from
NVIDIA/open-gpu-kernel-modules main (ctrl2080bus.h): the four words of
0x20801801 followed by pciProgrammingInterface, pciSubClass and
pciBaseClass. The class words come from the PCI class code, which the
PCI probe now passes down in RmapiGpu/nv_rs_rmapi_gpu (pdev->class).
Evidence: stock 580.196.07 replies captured with tools/ioctl_capture on an
EVGA GTX 1080 Ti (3842:6696, bus 01) and gdevenyi's ASUS capture on #564
(1043:85f1, bus 02) are reproduced byte for byte by new unit tests that
go through the RM_CONTROL escape path. The bus number is not part of this
reply; pci.bus_id keeps coming from 0x21b, which already matched stock.
0x2080012f is left alone: stock 580.196.07 also answers 0x56 on this
non-ECC GP102 (#371), and master already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgXrs8WswQymXpCe2YSiEM
* fix(gsp): keep NV2080_CTRL_CMD_BUS_GET_PCI_INFO_V2 (0x2080183c) host-only on the GSP route
The synthetic descriptor added for pre-GSP GPUs made control_info() know
0x2080183c, so the GSP route's validate() would now pass it and forward it
to GSP-RM for an owned mirrored object. Before this PR the command was
unknown to the tables and answered on the host Node. Add it to the existing
host-only list next to 0x00801401 and 0x20808165 so GSP-RM never sees it.
Reported by CodeRabbit on #590.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgXrs8WswQymXpCe2YSiEM
---------
Co-authored-by: Dino Vitale <chaotikdino@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ga100: read the VBIOS from the PCI ROM image in an NVGI-wrapped PROM
The A100 PCIe 40 GB PROM starts with an "NVGI" header. Its first PCI ROM
image (0x55aa) is at 0x5e00, not at offset 0, so find_fwsec found no image.
vbios_load now finds the first 0x55aa image on a 512-byte boundary after an
NVGI header, copies the ROM from there and zeroes the tail.
[A] PROM layout from a dump of an A100 PCIe 40 GB (10de:20f1) board.
Host unit test nvgi_wrapped_prom_starts_at_the_first_pci_rom_image fails
before the change (left 0, right 24064) and passes after it. Offline gate
(fmt, clippy, cargo test, make modules, audit-codegen, native codegen,
gate cases, kernel archive) passes. No physical-silicon boot is claimed:
this board also needs V2 FWSEC descriptor support on the GA100 path.
* gsp: pci_rom_offset reads only whole words below len
Return 0 for a PROM shorter than 4 bytes, and scan only offsets whose
4-byte word fits in the PROM (0x200..=len-4). Test
short_prom_reads_only_whole_words_below_len uses a reader that panics on
an out-of-range read; it failed before this change.
---------
Co-authored-by: GrowDev1 <growdev1@users.noreply.github.com>
* uvm: sorted range and external-map tables with binary search; capacity 4096 -> 16384
The UVM ranges and external-map tables were unordered fixed arrays of
MAX_RANGES = 4096 entries with linear scans. A full table returned
NV_ERR_NO_MEMORY at about 4,000 pinned allocations (#412), and a larger
constant alone made every map slower.
Both tables are now dense and sorted (ranges by start, maps by
(gpu, start)). Lookups use partition_point; insert and remove move the
tail with element loops (black_box on the index, so no memmove). Loops
over all ranges stop at range_count. FILE_RANGES is 16384.
Tests: logarithmic probe bound per create/map/free, sorted order through
a managed split and VMA close, full-table NO_MEMORY, last-byte lookup.
Fixes#412
* uvm: charge the per-open file state to the opener's memcg
nv_rs_uvm_open allocates the handle and the UVM file state (about 1.87 MB
at the 16384 capacity) with GFP_KERNEL. The device is mode 0666, so a
local user could open it many times and grow kernel memory that no cgroup
limit sees. Allocate both with GFP_KERNEL_ACCOUNT, as dmabuf_p2p.c does,
so the opener's memory cgroup pays for each open and its limit applies.
The idle cost per open does not change. Lazy table capacity is a
possible follow-up.
---------
Co-authored-by: GrowDev1 <growdev1@users.noreply.github.com>
* hwmon: WIP temperature freshness correction with host-fixture tests
WIP contribution addressing #561 (temperature readings stay valid
after acquisition failures). Not ready for merge; submitted for
contributor review.
- Failed acquisitions invalidate the live channels they cover
(provider bits on failure are untrusted); a failed poll no longer
extends the freshness window and does not count as a successful
poll; retries are rate-limited and unsupported providers are
retried rather than latched.
- Per-channel acquisition stamps bound the served age (2 s cap) and
per-channel publication sequences provide same-tick ordering
between polls and mirror publications; reads take validity, stamp
and value in one critical section.
- Mirror snapshots are incremental: they never invalidate channels
they do not carry.
- Static limits (temp_max/temp_crit/power_cap) supplied by successful
polls are applied and preserved across failures.
Regression coverage: host fixture tests/hwmon-mock/ compiles the real
hwmon_adapter.c against a kernel API mock - 71/71 assertions (17
registration + 54 behavioral). Kernel build on 7.0.0-44-generic
headers: module gate 18/18.
Feedback incorporated from dcr000 on #561 (sample timestamps,
failed-poll semantics; the GP100 self-poll provider is intentionally
left out of this patch). Independent review: Codex (2f67d67e) - GO
for these two corrections, with the legacy-provider compatibility
limitation (ENODEV from the GA10x-only provider can invalidate recent
legacy-mirror data) and physical qualification remaining outstanding.
Prepared with AI assistance; operator-reviewed.
* hwmon: retain bounded mirror data when no active acquisition is possible
Addresses CodeRabbit's finding on the draft PR and the legacy-provider
compatibility gap recorded by Codex (2f67d67e): an -ENODEV poll (no
GA10x/GSP owner - mirror-only GPUs such as GP100, or a runtime that
has not started yet) no longer invalidates recent mirror publications.
Such polls are not acquired-channel errors: the mirror samples are
retained and expire by their own per-channel age bound, the provider
is retried every window and is never latched, and a runtime that
appears later acquires normally.
Real acquisition failures (non-ENODEV) keep the immediate
per-channel invalidation, and all freshness, ordering, static-limit
and incremental-mirror semantics are unchanged. Fixture updated:
ENODEV retains recent mirror data within its age bound, expiry still
applies, retries happen per window, and recovery works once the
provider appears (72/72 PASS: 17 registration + 55 behavioral).
* hwmon: align accepted poll intervals with the served-age bound
Addresses the remaining trivial CodeRabbit finding: with poll
intervals above roughly 500 ms, a healthy active provider's reading
expired under the 2 s served-age cap before the next poll could run,
producing artificial -ENODATA periods (merge-base kept the value).
The freshness limit itself is unchanged; instead the accepted maximum
poll interval is now aligned with it: NV_RS_HWMON_POLL_MAX_MS is 500
(the largest interval whose uncapped active age formula, 2*poll+1000,
stays within the 2 s bound), larger configured values are clamped
rather than refused so polling keeps working, and the clamp is
documented in the module parameter description. A static_assert ties
the interval and age constants together at compile time. Regression
tests: oversized intervals are clamped and stay fresh; the default
interval never starves a healthy provider (no re-poll inside the
rate-limit window, exactly one poll in the next). 83/83 PASS.
* hwmon: revert the polling clamp; document long-interval -ENODATA behavior
Per independent review (cdaf3ee0), revert the v7 polling clamp: the
established minimum-interval contract is preserved and hwmon_poll_ms
is again honored up to 60000 ms. The 2 s served-age bound is
unchanged and is never extended to bridge a long polling interval:
with hwmon_poll_ms above the age bound, cached samples legitimately
expire and reads return -ENODATA between eligible acquisitions. This
is now documented in the served-age comment and in the module
parameter description.
Configuration regression tests updated: long intervals honor the
requested minimum (no clamp, no re-poll inside the window) and expose
-ENODATA once the cache expires, then refresh at the next eligible
poll; intermediate intervals (1000 ms) return -ENODATA after expiry
and recover on the next eligible read; the default interval keeps a
healthy provider fresh without extra polls. 92/92 PASS.
* hwmon: allow immediate cold-start acquisition; keep failures rate-limited
Addresses the second CodeRabbit minor finding (verified against
b6f657b4): the zero-initialized attempt timestamp was a sentinel, not
a real attempt, so a freshly registered slot could be throttled before
its first poll when the Linux tick counter was below the poll
interval. A separate 'attempted' flag now gates the retry deadline:
the first attempt always runs (cold start acquires immediately, as the
merge base did), while subsequent attempts - successes, failures and
unsupported providers alike - remain rate-limited by the configured
interval. mark_polled also marks an attempt so a Rust-side poll
completion keeps its throttling semantics. Regression test: cold
start with a small tick counter acquires on the first read with
exactly one poll, and the window still suppresses further polls.
The first CodeRabbit minor finding (transport-latency vs acquisition
age on a late-RPC timeout) is an existing upstream producer-contract
limitation, not a regression of this patch: the merge base served the
delayed value indefinitely; this patch bounds it to the 2 s served
age. Producer-side acquisition timestamps remain the documented
follow-up.
* hwmon: partial-poll retention, separate loop index, C89 declarations, stale-bit clear
One minimal revision addressing the latest CodeRabbit minor finding and
dcr000's review items at 60112a59:
- Partially available telemetry: a successful poll that did not
acquire a channel no longer erases a still-fresh cached value for
that channel (a partial batch must not invalidate an unrelated
fresh mirror reading); the cached value is cleared only once it is
already past its served age. Failed acquisitions still invalidate
immediately.
- Separate loop index in nv_rs_hwmon_update_sample so the channel
stamp loop no longer reuses the enclosing slot index.
- The sysfs show helpers declare their locals at function top,
keeping kernels before 6.5 (-Wdeclaration-after-statement)
buildable.
- Timestamp expiry and wraparound: the first stale read clears the
channel's valid bit (publication-sequence guarded), so a jiffies
wraparound cannot revive an ancient reading; a new publication
restores it. Regression test added with a simulated 32-bit wrap.
Configurable freshness limits remain a separate design decision for
the maintainers (not changed here); the GP100 self-poll provider
stays with dcr000. Fixture 103/103 PASS; kernel-object gate 18/18.
* hwmon: conservative partial-poll semantics, in-lock expiry, wrap-safe age, strict-C89 helpers
Addresses Codex 36419308's four findings:
1. Partial-poll retention reverted: with the existing provider API an
absent channel cannot be told apart from a failed acquisition, so
successful polls conservatively invalidate channels they did not
acquire (v9 error semantics restored); per-channel acquisition/
error status from the provider remains the documented follow-up.
2. Read-side expiry evaluation and the stale-bit clear now happen
inside the same sample_lock critical section as the snapshot, so a
concurrently published sample (poll or mirror) is never discarded.
3. Age comparison uses the wrap-safe unsigned jiffies difference;
on every supported target (x86_64, arm64) stamps are 64-bit and
cannot compare young again. Fixture covers observed expiry, a huge
dormant offset and recovery.
4. The five sysfs helpers now declare locals before any statement;
verified with -Werror=declaration-after-statement on the guest.
Fixture 102/102 PASS (22 registration + 80 behavioral), also passing
under the strict declaration check; kernel-object gate 18/18.
* gv100/hbm: survey only the FBPAs the FBIO floorsweep fuse leaves enabled
survey_gv100_hbm() demanded all 16 FBPA PLLs readable, locked and equal.
A CMP 100-210 (10de:1df4, 12 GB, three HBM2 stacks) has FBPA 0..=3 fused
off: their PLL cfg/coeff registers answer 0xbadf2010 (PRI bus error)
while FBPA 4..=15 read cfg 0x29, coeff 0x14102 (877.5 MHz). The survey
refused the card (CfgUnreadable at FBPA 0), so the HBM2 session never got
a baseline and v100_hbm_ndiv was a no-op. program_coeff() made the same
assumption twice more: its post-write probe read FBPA 0, and its lock
wait polled all 16.
1. Survey mask. 580.178.04 does not probe for bus errors; it computes the
enabled-FBPA mask from the fuse. _nv030402rm (GV100 GPU HAL slot
+0x3a0) [D]:
n = RD32(0x2243c) NV_PTOP_SCAL_NUM_FBPAS
fuse = OBJFUSE+0x118(0xff000033) _nv029006rm
-> OBJFUSE+0x110 _nv028950rm: fuse word 0xc14, shift 0,
mask 0xffff, i.e. BAR0 0x21c14
mask = zext64(~fuse); if n <= 64: mask &= ~0 >> (64 - n); n == 0: 0
A stock mmiotrace of a Tesla V100 shows that pair once, 0x2243c = 0x10
then 0x21c14 = 0 [O] (reports/original-mmiotrace-b3-first/b3-bar0.txt),
which gives 0xffff. On the #399 card the reporter read 0x2243c = 0x10
and 0x21c14 = 0xf [O], which gives 0xfff0 and matches the partitions
that answer.
2. Post-write probe on the first enabled FBPA instead of FBPA 0.
3. Lock wait polls only the enabled FBPAs.
Stock never retunes the HBM2 PLL, so 2 and 3 have no stock evidence;
they follow from 1. On silicon [O]: the reporter ran 23db150 with the
equivalent change (presence taken from the bus-error word rather than
the fuse) on the #399 card and got a verified 877.5 -> 1107 MHz unlock
(NDIV 65 -> 82) on FBPA 4..=15, D2D 618 -> 781 GB/s, then adaptive
backoff on real ECC DBE/SBE and a clean return to NDIV 65
(https://github.com/QuixiAI/nvdriver/issues/399#issuecomment-7386631509).
This exact commit has not run on silicon.
fbio_enabled_mask() is the stock arithmetic and gv100_enabled_fbpa_mask()
the two reads, in stock order. An enabled partition must still be
readable, locked and in agreement (the reference coefficient is the first
enabled partition's), so a card whose fuse says 16 but whose FBPA 0 does
not answer is refused as before. The mask is resolved before the
multicast write; if 0x2243c is unreadable, 0 or above 16, or the fuse is
unreadable or enables nothing, the survey reports the new fault kinds
FbpaCountUnusable (6) / FbioFuseUnusable (7) and nothing is written. A
mask lost between the survey and the write is a refusal before the target
write, like the PMC_BOOT_0 canary: logged as SurveyFailed, not RolledBack.
gpu_owner.c logs kinds 6 and 7, and the CoeffMismatch text now says "the
first enabled FBPA" instead of "FBPA 0". A 16-partition card does two
more BAR0 reads per survey and per program_coeff and otherwise behaves as
before. The ECC poll and the backoff logic are unchanged.
Tests: fbio_enabled_mask_matches_nv030402rm_arithmetic,
gv100_hbm_survey_and_unlock_skip_fused_off_fbpas (mock with FBPA 0..=3
reading 0xbadf2010, fuse 0xf: survey, unlock 65 -> 82, backoff step,
restore; refusals with zero writes for unusable mask inputs), and
gv100_hbm_mask_lost_before_the_target_write_is_not_a_rollback. Without
the change the first survey assertion fails; reverting only the probe or
only the lock wait makes the unlock fail.
Refs #399
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* gv100/hbm: fall back to cached floorsweep mask on rollback/restore and log teardown failure
Addresses CodeRabbit review finding on PR #583:
- Cache the static silicon enabled-FBPA mask resolved during baseline survey
(HbmSession::enabled_fbpa_mask and inside unlock/set rollback paths).
- If re-reading PTOP_SCAL_NUM_FBPAS (0x2243c) or FUSE_OPT_FBIO (0x21c14)
glitches during a rollback or teardown restore, fall back to the cached
mask so the baseline HBM2 coefficient write is not blocked while PMC_BOOT_0
canary remains strictly enforced.
- Log failed HBM2 teardown restores in pmu_bringup.rs via log_hbm_outcome
instead of discarding the result.
- Add unit test covering fuse-glitch teardown restore and canary refusal.
* gv100/hbm: use cached floorsweep mask for downward safety steps (ECC backoff / baseline return)
Addresses follow-up CodeRabbit finding on PR #583:
- In HbmSession::step_to, downward safety steps (target <= current clock:
live ECC backoff via on_instability and sysfs return to baseline) fall
back to the cached static silicon enabled-FBPA mask on a transient read
failure of 0x2243c/0x21c14 so an elevated clock is never stranded while
the GPU remains in service.
- Upward overclock steps continue to require a fresh fuse read and refuse
before writing when unreadable.
- Extend unit test to cover on_instability and on_user_write(0) under a
fuse-read glitch.
* gv100/hbm: skip rollback write on pre-write mask refusal
Addresses CodeRabbit trivial finding on PR #583:
- When program_coeff refuses before the target write due to an unreadable
FBPA count (FbpaCountUnusable) or FBIO fuse (FbioFuseUnusable), skip the
unnecessary rollback multicast write so the PLL stays completely untouched
(writes == 0) and a clean refusal can never degrade into FailedUnverified.
- Preserve existing pre-write canary refusal behavior unchanged.
---------
Co-authored-by: Scottcjn <121303252+Scottcjn@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com>
* dmabuf: export RM video memory by handle
NV_ESC_EXPORT_TO_DMABUF_FD (0xd9) only exported a raw BAR1 range, for
CAP_SYS_ADMIN, ignoring the RM handles in the request. Implement the
stock ABI (nv_ioctl_export_to_dma_buf_fd_t, 2608 bytes):
- resolve each (hClient, hMemory, offset, size) to its VRAM with
nv_rs_rmapi_resolve_dmabuf_object(), authorized like the original:
the client belongs to the caller's file or its control file
(CAP_SYS_ADMIN may export any);
- a non-contiguous allocation (scatter_id != 0) is walked segment by
segment, each piece of the requested range becoming its own BAR1
extent, so an export never covers the VRAM between two segments;
- up to 128 objects per call, batched calls (index > 0) for larger
VMM exports, contiguous extents coalesced, segments capped at 1 GiB,
at most 2^20 extents per dma-buf; its kernel memory (pins, extents)
grows with the objects appended, not the declared total, and is
charged to the caller's memory cgroup;
- the dma-buf is BAR1-backed (the GA10x BAR1 maps VRAM 1:1), mapped for
importers with dma_map_resource(); bAllowMmap allows a write-combined
CPU mmap, shared only (a private, copy-on-write mapping of PFN-mapped
memory is refused: vmf_insert_pfn() BUG()s on one). The raw BAR1
export stays for h_client == 0 (admin only);
- only GSP-RM GPUs export: their BAR1 maps VRAM 1:1 for as long as the
GPU is in the RM. A pre-GSP GPU's BAR1 window belongs to the runtime
engines, which clear it when they stop (suspend, AER) while an export
would keep its offsets, so those GPUs refuse (NV_ERR_NOT_SUPPORTED);
- the fd is reserved, and installed only once the reply carrying it has
been copied to the caller: a reply that does not arrive leaves no fd,
and no pin, behind (the raw BAR1 export included).
A dma-buf must not outlive its memory: once the VRAM is freed it can be
handed to another allocation, and a peer still DMAing into the old
range would write into it. The dma-buf therefore holds the memory, as
the stock driver's exports do. Each exported object's backing is pinned
in the RM memory table (Table::pin_export, the reference the FD exports
already take), and every route that frees memory honours it:
NV_ESC_RM_FREE, NVOS32_FUNCTION_FREE (NV_ESC_RM_VID_HEAP_CONTROL),
freeing a parent or the whole client, file release, and channel USERD
orphan cleanup drop the handle but leave the VRAM, and a non-contiguous
allocation's segment chain, allocated while a pin exists. (The orphan
cleanup released a segment chain without that check; it now has it.)
When the dma-buf is released, a work item drops its pins under the RM
API lock and frees whatever nothing else references; a dma-buf can be
released with that lock held, so its release callback does not take it.
Module unload flushes the work item. Exports resolve their handles and
take their pins under the same lock, so a concurrent free either runs
first, and the export fails, or finds the pin.
Only GPU removal still revokes, as the memory goes away regardless.
It first marks the device as going away: from then until the GPU has
left the RM no dma-buf is created over it (the check and the insertion
into the export list are under one lock hold, so an export is either
listed or refused). Before taking the RM API lock, so that RM calls do
not wait behind the importers, every dma-buf over the device is first
marked revoked (attach, map and mmap then fail with -ENODEV) and its
CPU mappings are zapped; then its importers' mappings are invalidated
(dma_buf_invalidate_mappings), those whose reservation object is free
first; only then are the two waits the kernel-doc asks for done for
each: until the fences on the reservation object retire, and until
every importer mapping has been unmapped. An importer slow to retire
its fences, or holding a reservation object, thus leaves no other
dma-buf readable. A dma-buf whose last reference is already going is
waited for until its release has queued its pins, which are then
flushed, so none is dropped after the GPU is gone. Then,
under the lock and before the GPU leaves the RM, the pins are dropped;
nothing waits there. The CPU zap is unmap_mapping_range(); CPU mappings
are filled in at fault time
(vmf_insert_pfn after checking `revoked` under the dma-buf's lock), not
in .mmap, because the kernel links a new VMA into the file's i_mmap
only after .mmap returns and pages inserted there could escape a racing
zap. After a revoke a CPU access gets SIGBUS.
Only importers that can honour a revoke may attach: peer-to-peer
capable (allow_peer2peer, the scatterlist has BAR1 bus addresses and no
struct pages) and revocable (dma_buf_attach_revocable(): they
invalidate and unmap in bounded time). The NVMe dma-buf I/O path is
both. Kernels without dma_buf_attach_revocable() have no such contract
(move_notify only asks importers to remap as soon as possible), so
there the dma-buf has no importers, only the CPU mmap. The exporter is
dynamic (pin/unpin, a no-op: BAR1 memory never moves), so that no
kernel caches an importer's mapping at attach time, where its unmap
would not reach the exporter.
Built against 7.4 only. dma_buf_attach_revocable(), the
invalidate_mappings rename and enum dma_resv_usage are probed in Kbuild
with fallbacks for older kernels, which have not been compiled.
Tested on an RTX 3050 Laptop (GA107), on a 7.4-rc2 kernel with KASAN
and lockdep, IOMMU in identity mode, with io_uring + NVMe dma-buf reads,
through the export by CUDA address added later in this series. That
shares the dma-buf creation, mapping, pinning and release code with
this ioctl but not its handle loop: libcuda does not issue
NV_ESC_EXPORT_TO_DMABUF_FD on this GPU, so multi-object and batched
exports have not run on hardware. NVMe -> VRAM reads were verified
byte for byte. With the memory freed (cuMemFree, cuMemRelease) while
128 reads were queued, or at points in the middle of a stream, every
read completed without error, and the freed VRAM was not reused: a new
allocation filled before the free stayed untouched. The VRAM stays
allocated while the dma-buf is open (free VRAM did not come back after
the RM free) and is returned when it is closed. A dma-buf whose
exporter exited keeps working, and killing a reader mid-I/O tears it
down. No KASAN or lockdep report. GPU removal (the remaining revoke)
is run on hardware by the test added in the third commit.
These runs used the gpu-prio `preempt 0` policy: on this GPU, master's
default CILP/GFXP preemption policy makes cuCtxCreate fail before any
export (the second channel's compute object allocation returns
NV_ERR_INSUFFICIENT_RESOURCES), with or without this series.
* gsp_route: answer GPU_GET_INFO DMABUF_CAPABILITY as kernel RM does
NV2080_CTRL_GPU_INFO_INDEX_DMABUF_CAPABILITY (0x3d) is answered by
NVIDIA's kernel-side RM, not by GSP-RM: subdevice_ctrl_gpu_kernel.c
returns YES when osDmabufIsSupported(). GSP-RM has no dma-buf and
answers NO, and the GA10x routing passed that through. nvdriver exports
dma-bufs itself (NV_ESC_EXPORT_TO_DMABUF_FD), so answer YES like the
kernel-side RM, on every path that answers the index: GSP-RM's V2
reply, the V2 reply a V1 GET_INFO is translated to, an R620-sized V2
query translated to 580 batches, and nvdriver's native GET_INFO_V2
table.
libcuda 580.178.04 queries this index, but on a GeForce laptop GPU it
still reports CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED=0 afterwards and
never issues the export ioctl: its decision depends on more than this
answer. This only makes the answer correct.
* uvm: export a CUDA allocation as a dma-buf by GPU address
libcuda only exports a dma-buf through cuMemGetHandleForAddressRange,
and on GPUs it reports CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED=0 for (a
GeForce RTX 3050 Laptop here) it refuses in user space with
CUDA_ERROR_NOT_SUPPORTED, before asking the kernel. The RM handles that
NV_ESC_EXPORT_TO_DMABUF_FD needs live inside libcuda, so an application
cannot call the ioctl itself.
The UVM node knows them: UVM_MAP_EXTERNAL_ALLOCATION maps (hClient,
hMemory, offset) at a GPU virtual address. Record them in each
ExternalMap (and carry them through uvm_ext_gpu_map_split, the piece
after a hole moving its offset along), and add an nvidia_rs ioctl on
the process's own /dev/nvidia-uvm VA-space fd:
NV_RS_UVM_EXPORT_DMABUF (0x4e520001)
{ u64 va; u64 size; u32 flags; s32 fd; u32 status; s32 rm_fd; }
[va, va + size) must be page aligned and lie inside one external
mapping; flags bit 0 allows a (shared) CPU mmap. The range resolves to
its RM memory and goes through the same export as
NV_ESC_EXPORT_TO_DMABUF_FD (nv_rs_rmapi_export_dmabuf_object(), a single
extent), so it gets the same lifetime (the dma-buf pins the memory)
and the same authorization: the memory's client must belong to rm_fd,
an RM file the caller holds (or to its control file), the way UVM's
rmCtrlFd names it. The UVM mapping is
not enough on its own: UVM_MAP_EXTERNAL_ALLOCATION also accepts objects
shared through NV_ESC_RM_SHARE, which this export does not. If GPUs'
mappings of the range name different memory, the address is ambiguous
and refused. The lookup takes only the UVM lock (it reads this file's VA
space); the export then resolves the memory again under the RM API lock,
so a mapping changed in between exports memory the caller still owns, or
fails. As for NV_ESC_EXPORT_TO_DMABUF_FD, the fd is installed only once
the reply has been copied out.
tools/nv_rs_dmabuf.h wraps it (nv_rs_export_dmabuf(ptr, size, flags,
&status) finds the UVM and RM fds in /proc/self/fd); tools/
cuda_dmabuf_uvm_export_test.c checks that the dma-buf is the
allocation's VRAM (CPU mmap reads what cuMemcpyHtoD wrote and
cuMemcpyDtoH reads what it wrote, whole and for a sub-range), that bad
ranges and private mmaps are refused, that an export whose reply cannot
be copied back leaves no fd, and that the dma-buf keeps a
freed cuMemMap allocation: an existing CPU mapping still reads its
data, and writes through it never reach a new allocation.
On the RTX 3050 Laptop with io_uring + NVMe dma-buf reads (block layer
support from the io_uring dma-buf series in 7.4; ext4 needs out-of-tree
patches, device-mapper is refused), NVMe reads land in VRAM at the speed
they land in host memory on a Gen3 x4 drive (3.2 GB/s), and at ~75% of
it from a Gen4 x4 drive on another root port (5.1 vs 6.8 GB/s).
tools/dmabuf_unbind_race_test.py (run by tools/dmabuf_unbind_race_run.sh)
exercises the GPU-removal revoke from commit 1 through this export: it
unbinds nvidia_rs from the GPU while an io_uring reader keeps 32 NVMe
reads in flight into an exported buffer, another export carries an
unsignaled sw_sync write fence (signaled HOLD seconds into the unbind),
an RM-call loop runs, and an export loop runs. Its io_uring side is fastsafetensors' io_uring
dma-buf layer (IoUring); the export is its own, the ioctl of
tools/nv_rs_dmabuf.h. The reader exports after the
fenced buffer, so the revoke meets the fence first. On the RTX 3050
Laptop with a 5 s hold (three runs), exports were refused from 9-29 ms
into the unbind, every in-flight read completed with -ENODEV by
24-51 ms (the fenced buffer did not keep the reader's readable), RM
calls kept completing without a failure (slowest call 182 ms) while the revoke waited
for the fence, and the GPU teardown under the RM API lock started right
after the fence was signaled. Lockdep stayed on through the run, with no
KASAN or lockdep report.
---------
Co-authored-by: Arsenova <arsenova@a7snv.com>
Instead of hardcoding nine PCI device IDs in gpu_name_string() (0x20800110)
and returning generic architecture placeholders for all other cards, resolve
the exact product name via crate::hardware::product(device, subvendor, subdevice)
from the 1,129-entry stock 580.178.04 product matrix and CMP_UNLOCK_PRODUCTS
(preserving the architecture-based fallback for unlisted/SoC IDs like GV11B).
This automatically reports exact stock names for RTX 4070 Ti SUPER (0x2705,
refs #533), CMP 100-210 (0x1df4, refs #399), TITAN Xp (0x1b02), subsystem-
specific SKUs (e.g. V100-SXM2-32GB-LS, RTX 3050 Laptop GPU), and the full
Maxwell-Blackwell lineup without adding any new static tables.
Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com>
When UVM_MAP_EXTERNAL_ALLOCATION fails mid-way while mapping host system
memory (for example on NO_MEMORY / 0x51 during a large multi-GiB mapping as
reported in #412, or on a missing host DMA page), VaSpace does not record
the external mapping slot so UVM_FREE never unmaps those pages. Previously,
the host-memory branch in uvm_node::map_external() left the partially
written PTEs in the GPU page tree without unmapping or flushing the TLB.
- Validate 4 KiB alignment of base, offset, and length in the host-memory
branch of uvm_node::map_external() (and of length in
va_space::map_external_host_pages()) before touching DMA or PTEs.
- Unmap [base, base + failure.mapped_bytes) and flush the GPU TLB on
failure in uvm_node::map_external() (matching the video-memory and
peer-BAR1 paths) while keeping failure.mapped_bytes in the diagnostic.
- Roll back partial PTEs and flush the GPU TLB on NO_MEMORY in
uvm_node::map_channel_resource().
- Preflight range/DMA validation in uvm_node::managed_map_gpu() before
writing PTEs and flush the TLB if an OOM stops after writing a prefix.
Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com>
* gv100: bond PCEs before the CEs run after a warm handoff (fixes#134 item 1)
After stock nvidia.ko unloads, PCE2LCE holds its PCIe map [f,2,3,0,1,f,f,f,f]
and CE0..CE8 are disabled in NV_PMC_ENABLE. Bring-up enables the CEs and
only then writes the NVLink map (PCE 1 + PCE 8 -> LCE 3). The registers read
back right, but PCE 8 does not take the new bonding while its CE is running:
the CE3 scrubber's self-test passes (semaphore only), its first memset times
out, stop_scrub_ce cannot preempt (dead0002), retire_pending sticks and every
NV01_MEMORY_LOCAL_USER alloc returns 0x65.
- adapter_start: before the first engine reset, if the CEs are still disabled
and the map differs, write the NVLink map (prebond_gv100_ce_pce2lce, note
0x53430002).
- pmu_bringup: if the map still differs there, write it with CE0..CE8 held in
reset, then run the normal sequence so the prod/pipelined registers land on
running engines (reset_and_configure_gv100_ce_pce2lce). A no-op when the
map already matches, as on a cold boot.
* fix(gv100): propagate PMC_ENABLE write errors and clear prebond map when NVLink is not ready
* fix(gv100): fall through to normal teardown when CE reset/configure fails
---------
Co-authored-by: TheWeakShall <22898767+TheWeakShall@users.noreply.github.com>
Co-authored-by: Eric Hartford <eric@quixi.ai>
Adds two independent reproductions of the NV_ERR_NOT_SUPPORTED VOLT_LOAD cap at 5879d3b3:
a Tesla V100-PCIE-32GB (10de:1db6) on kernel 7.0.0-44 and a Tesla V100-SXM2-32GB (10de:1db5)
on kernel 6.8.0-151, both requesting NDIV 183 (1372.5 MHz) at 905 mV and both landing on 1290
MHz with the identical load=0xd6d6d6d6 get=0x56 set=0xffff signature, while HBM reaches
1107.0 MHz on both.
PCIe and SXM2 packages, two kernel series and two target voltages answer the same way, which
supports the existing conclusion that the missing piece is the PMU task stack rather than the
board or the RPC payload.
Records the 2026-12-04 reboot verification of 10.1.1.200 and 10.1.1.122 on upstream HEAD
(module set, PCI binding, devnodes bind mounts, capability surface, taint 12288 with stock
nvidia absent, NVML/CUDA and the user's Strata healthy on both).
Also notes that the b764024 (#472) 'no devices' regression does not reproduce at HEAD, the
new nvidia_rs_drm/nvidia_rs_modeset 4-reference leak filed as #528 (do not unload those two
modules on a host you still want to reload nvidia_rs on), the QuixiAI/nvdriver ->
nvdriver/nvdriver rename with the outside-collaborator constraints, and that 10.1.1.122 now
runs the live HBM unlock under load (877.5 -> 1107.0 MHz, no interruption).