summaryrefslogtreecommitdiffstats
path: root/kernel/main.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-04 17:40:47 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-04 17:40:47 -0500
commitb6c8e74164716acdcdb3d34e05966deec4f9f35b (patch)
treeec10cd351feca570a7b256a3279f78f566c57f0e /kernel/main.c
parent70d8f709224ed4d2064bff8d176db3dbdb74fce5 (diff)
downloadopen-iov-b6c8e74164716acdcdb3d34e05966deec4f9f35b.tar.gz
open-iov-b6c8e74164716acdcdb3d34e05966deec4f9f35b.zip
vgsp-diag: whole-vidmem page-hash bracket - sema_gl_vidmem_bracket hashes every 4KB page of the BAR1 shadow before the GR publish and diffs after the output-retirement wait, reporting any changed page outside the sampled output set; vidmem_hash_snap/vidmem_hash_diff manual module params; default 0 is a strict no-op
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
index c96abf8..458ba36 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -3660,6 +3660,38 @@ module_param_cb(dump_vidmem, &nv_vgpu_dump_vidmem_ops, NULL, 0200);
MODULE_PARM_DESC(dump_vidmem, "Dump emulated vidmem range (hex offset,hex len)");
/*
+ * Whole-vidmem page-hash bracket: snapshot every 4 KB page hash of the
+ * emulated vidmem, then re-hash and report the pages whose content changed.
+ * echo 1 > .../parameters/vidmem_hash_snap
+ * echo 1 > .../parameters/vidmem_hash_diff
+ */
+static int nv_vgpu_vidmem_hash_snap_set(const char *val,
+ const struct kernel_param *kp)
+{
+ return gsp_sema_service_vidmem_hash_snapshot();
+}
+
+static int nv_vgpu_vidmem_hash_diff_set(const char *val,
+ const struct kernel_param *kp)
+{
+ return gsp_sema_service_vidmem_hash_diff("manual", 64);
+}
+
+static const struct kernel_param_ops nv_vgpu_vidmem_hash_snap_ops = {
+ .set = nv_vgpu_vidmem_hash_snap_set,
+};
+
+static const struct kernel_param_ops nv_vgpu_vidmem_hash_diff_ops = {
+ .set = nv_vgpu_vidmem_hash_diff_set,
+};
+
+module_param_cb(vidmem_hash_snap, &nv_vgpu_vidmem_hash_snap_ops, NULL, 0200);
+MODULE_PARM_DESC(vidmem_hash_snap, "Snapshot whole-vidmem page hashes");
+module_param_cb(vidmem_hash_diff, &nv_vgpu_vidmem_hash_diff_ops, NULL, 0200);
+MODULE_PARM_DESC(vidmem_hash_diff,
+ "Diff whole-vidmem page hashes (tag manual, first 64 pages)");
+
+/*
* Debug: hex-dump or scan the BAR0 register shadow. Guest MMIO writes that go
* through the mapped shadow never reach the write callback, so this is the
* only way to observe registers the guest writes directly (e.g. the