From 5757095befda5982e90b3a3af78b57c339e9ab53 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Tue, 29 Sep 2026 15:41:01 -0400 Subject: sema-svc: sema_skip_ops parameter (apply releases without running pushed memsets) --- kernel/gsp_sema_service.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'kernel/gsp_sema_service.c') diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index 0c0e85b..e21c997 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -2258,7 +2258,7 @@ static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf, svc_rel_va_seen = va; /* The push's work always runs; see the * REPORT_SEM comment below. */ - if (allow_ops && n_ops) { + if (allow_ops && n_ops && !gsp_sema_skip_ops) { svc_run_ops(vgpu, ops, n_ops); svc.ring_ops++; ops_runs++; @@ -2341,11 +2341,11 @@ static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf, * through a trusted ring translation, so this * cannot run swept-RAM false positives. */ - if (allow_ops && n_ops) { - svc_run_ops(vgpu, ops, n_ops); - svc.ring_ops++; - ops_runs++; - } + if (allow_ops && n_ops && !gsp_sema_skip_ops) { + svc_run_ops(vgpu, ops, n_ops); + svc.ring_ops++; + ops_runs++; + } n_ops = 0; if (svc_sem_read(vgpu, va, &cur)) break; @@ -2542,7 +2542,7 @@ static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf, * Ops are only ever collected from pushes read * through a trusted ring translation. */ - if (allow_ops && n_ops) { + if (allow_ops && n_ops && !gsp_sema_skip_ops) { svc_run_ops(vgpu, ops, n_ops); svc.ring_ops++; ops_runs++; @@ -3362,6 +3362,18 @@ unsigned gsp_sema_gr_grace_ms = 8000; */ bool gsp_sema_fake_rel; +/* + * Skip executing a push's collected work (CE memsets/copies into the vidmem + * shadow) while still applying its semaphore release. The client only ever + * observes the release; the shadow writes exist so the emulation can walk + * page tables it built, and the critical translations are injected from guest + * truth instead. Running thousands of memsets per context creation is what + * pushes the client past its context-init deadline; skipping them trades + * emulation-internal fidelity for the latency the client deadline requires. + * Off by default; enabled per run through the module parameter. + */ +bool gsp_sema_skip_ops; + static unsigned long svc_gr_ring_tried; /* ranks that got a diagnostic line */ static void svc_gr_ring_autopin(struct nv_vgpu_device *vgpu, -- cgit v1.2.3