From 612bcec57229d1e74b04cac36d0f4b62a9bf9ebd Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Mon, 28 Sep 2026 15:20:04 -0400 Subject: sema: add walk_probe - trace the page-table walk for a VA New module parameter walk_probe runs the recorded-va-space walks and the discovered-directory walk directly (pin/lat/pair map bypassed) with per-level tracing, and prints the result of each. This separates 'the page tables are not walkable' from 'the VA->PA pair map already answers' when a translation is missing. Baseline on a live boot: root PDB entries are zero (L0 e=0 idx=0) so the writes UVM issues into the level pages have no parent entry yet. --- kernel/gsp_sema_service.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'kernel/gsp_sema_service.c') diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index 734fb1d..0578d3c 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -3427,6 +3427,76 @@ int gsp_sema_service_probe(u64 gpu_va, u32 count) return 0; } +/* + * Diagnostic: run the page-table walks directly for one VA (pin/lat/map + * bypassed), with per-level tracing. Answers "are the written page tables + * walkable?" independently of the discovered VA->PA pair map, which is the + * only way to tell whether the GPU page tables in vidmem actually work. + */ +static struct completion walk_probe_done; +static u64 walk_probe_va; +static bool walk_probe_pending; + +static void svc_handle_walk_probe(struct nv_vgpu_device *vgpu) +{ + u64 va; + int i; + + if (!walk_probe_pending) + return; + + va = walk_probe_va & ~(u64)(SEMA_PAGE_SIZE - 1); + pr_info("sema-walk-probe: va=0x%llx discovered pdb=0x%llx ap=%d entries=%u found=%u\n", + va, svc_pd_base, svc_pd_ap, svc_pd_entries, svc_pd_found); + + for (i = 0; i < SVC_MAX_VASPACES; i++) { + u64 addr = 0; + int ap = SVC_APERTURE_SYS; + int rc; + + if (!svc.vas[i].valid) + continue; + pr_info("sema-walk-probe: vas[%d] h=0x%x pdb=0x%llx ent=%u ap=%d\n", + i, svc.vas[i].h_vaspace, svc.vas[i].pdb, + svc.vas[i].entries, svc.vas[i].ap); + rc = svc_gmmu_walk(vgpu, svc.vas[i].pdb, + svc.vas[i].entries, va, svc.vas[i].ap, + &addr, &ap, true); + pr_info("sema-walk-probe: rc=%d pa=0x%llx aperture=%s\n", + rc, addr, + ap == SVC_APERTURE_FB ? "vidmem" : "ram"); + } + + { + u64 addr = 0; + int ap = SVC_APERTURE_SYS; + int rc = svc_walk_discovered(vgpu, va, &addr, &ap); + + pr_info("sema-walk-probe: discovered rc=%d pa=0x%llx aperture=%s\n", + rc, addr, + ap == SVC_APERTURE_FB ? "vidmem" : "ram"); + } + + walk_probe_pending = false; + complete(&walk_probe_done); +} + +int gsp_sema_service_walk_probe(u64 gpu_va) +{ + if (!svc.task) + return -ENODEV; + + init_completion(&walk_probe_done); + walk_probe_va = gpu_va; + walk_probe_pending = true; + + if (!wait_for_completion_timeout(&walk_probe_done, 3 * HZ)) { + walk_probe_pending = false; + return -ETIMEDOUT; + } + return 0; +} + /* * Diagnostic dump of the service's channel table: GPFIFO/USERD state, the * pending-entry expectation and the two NvNotification slots the client polls @@ -3615,6 +3685,7 @@ static int svc_thread(void *arg) } svc_handle_probe(vgpu); + svc_handle_walk_probe(vgpu); svc_handle_map_add(); svc_handle_chan_dump(vgpu); -- cgit v1.2.3