summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_sema_service.c61
-rw-r--r--kernel/gsp_sema_service.h3
-rw-r--r--kernel/main.c2
3 files changed, 66 insertions, 0 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index ea96595..eddc73d 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -8985,6 +8985,60 @@ static void svc_qmd_accum(struct nv_vgpu_device *vgpu, struct svc_channel *ch,
static u64 svc_pass_hash; /* r391f: this decode pass's push content hash */
+/*
+ * r481 RISK-REDUCTION diagnostic (default 0): dump the full decoded method
+ * stream of the first few large GR-class pushes (len >= 1024) so the launch
+ * push's acquire/release method groups (or their absence) are visible
+ * verbatim. The streams_events class evidence shows the st2 vadd's copy-in
+ * running ~115 ms BEFORE its stream's H2D soft copies; the ordering the
+ * driver relied on is only provable by reading the push's own methods.
+ * Bounded: gsp_sema_push_raw dumps, at most once per push VA.
+ */
+unsigned gsp_sema_push_raw;
+static u64 svc_pushraw_last_va;
+static u32 svc_pushraw_n;
+
+static void svc_push_raw_dump(const u8 *buf, u32 len, u64 push_va,
+ u32 h_object)
+{
+ u32 off = 0, gi = 0;
+
+ if (svc_pushraw_n >= gsp_sema_push_raw || !gsp_sema_push_raw)
+ return;
+ if (push_va == svc_pushraw_last_va)
+ return;
+ svc_pushraw_last_va = push_va;
+ svc_pushraw_n++;
+ pr_info("sema-pushraw: BEGIN h=0x%x va=0x%llx len=%u n=%u\n",
+ h_object, push_va, len, svc_pushraw_n);
+ while (off + 4 <= len && gi < 128) {
+ u32 hdr, cnt, addr, v[8], k, n;
+
+ memcpy(&hdr, buf + off, 4);
+ if ((hdr >> 29) != 1) {
+ pr_info("sema-pushraw: off=0x%x raw=%08x (not a method header)\n",
+ off, hdr);
+ break;
+ }
+ cnt = (hdr >> 16) & 0xfff;
+ addr = (hdr & 0x1fff) << 2;
+ n = cnt > 8 ? 8 : cnt;
+ for (k = 0; k < n && off + 4 + 4 * k + 4 <= len; k++)
+ memcpy(&v[k], buf + off + 4 + 4 * k, 4);
+ pr_info("sema-pushraw: [%u] off=0x%x addr=0x%x cnt=%u v0=%08x v1=%08x v2=%08x v3=%08x v4=%08x\n",
+ gi, off, addr, cnt,
+ n > 0 ? v[0] : 0, n > 1 ? v[1] : 0,
+ n > 2 ? v[2] : 0, n > 3 ? v[3] : 0,
+ n > 4 ? v[4] : 0);
+ if (!cnt)
+ break;
+ off += 4 + cnt * 4;
+ gi++;
+ }
+ pr_info("sema-pushraw: END h=0x%x va=0x%llx consumed=0x%x/%u\n",
+ h_object, push_va, off, len);
+}
+
static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf,
u32 len, u64 page_pa, bool allow_ops,
struct svc_channel *ch, u32 entry_idx,
@@ -9049,6 +9103,13 @@ static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf,
allow_ops = false;
}
+ /*
+ * r481: verbatim method-stream dump for large GR-class pushes
+ * (default 0 = off). See svc_push_raw_dump.
+ */
+ if (gsp_sema_push_raw && ch && !ch->engine_type && len >= 1024)
+ svc_push_raw_dump(buf, len, push_va, ch->h_object);
+
memset(&st, 0, sizeof(st));
st.push_va = push_va;
/*
diff --git a/kernel/gsp_sema_service.h b/kernel/gsp_sema_service.h
index 3765cd2..305a027 100644
--- a/kernel/gsp_sema_service.h
+++ b/kernel/gsp_sema_service.h
@@ -313,6 +313,9 @@ extern bool gsp_sema_wait_gate;
/* r401: bounded acquire-wait hold (fail-open) in ms; must exceed the
* emulated launch completion latency for copy-after-launch ordering. */
extern unsigned gsp_sema_wait_hold_ms;
+/* r481: verbatim method-stream dump for the first N large GR pushes
+ * (default 0 off). Diagnostic only; no behaviour change. */
+extern unsigned gsp_sema_push_raw;
/*
* r384 (guest boot-corruption lottery): fill-destination guards (default
diff --git a/kernel/main.c b/kernel/main.c
index 0110372..3ee5c23 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -2832,6 +2832,8 @@ module_param_named(sema_wait_gate, gsp_sema_wait_gate, bool, 0644);
MODULE_PARM_DESC(sema_wait_gate, "honor C56F host-semaphore acquires before running a ring entry's work (default 1 since r408; 0 restores pass-through)");
module_param_named(sema_wait_hold_ms, gsp_sema_wait_hold_ms, uint, 0644);
MODULE_PARM_DESC(sema_wait_hold_ms, "bounded acquire-wait hold before fail-open, ms (r401, default 4000; must exceed the emulated launch latency)");
+module_param_named(sema_push_raw, gsp_sema_push_raw, uint, 0644);
+MODULE_PARM_DESC(sema_push_raw, "r481 diagnostic: dump the decoded method stream of the first N large GR pushes (default 0 off)");
MODULE_PARM_DESC(sema_copy_dst_pin_guard, "hold device-dst copies without a pin-resolved translation (default 1)");
/*