diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-29 15:41:01 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-29 15:41:01 -0400 |
| commit | 5757095befda5982e90b3a3af78b57c339e9ab53 (patch) | |
| tree | 0ca0061e029e87564e42692e482b0e54c0dc4813 | |
| parent | b7636afd9715748396325ec4dd0899c7f42ece17 (diff) | |
| download | open-iov-5757095befda5982e90b3a3af78b57c339e9ab53.tar.gz open-iov-5757095befda5982e90b3a3af78b57c339e9ab53.zip | |
sema-svc: sema_skip_ops parameter (apply releases without running pushed memsets)
| -rw-r--r-- | kernel/gsp_sema_service.c | 26 | ||||
| -rw-r--r-- | kernel/gsp_sema_service.h | 6 | ||||
| -rw-r--r-- | kernel/main.c | 9 |
3 files changed, 34 insertions, 7 deletions
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, diff --git a/kernel/gsp_sema_service.h b/kernel/gsp_sema_service.h index 8cd9e61..615d092 100644 --- a/kernel/gsp_sema_service.h +++ b/kernel/gsp_sema_service.h @@ -78,6 +78,12 @@ extern bool gsp_sema_gr_rings; extern bool gsp_sema_fake_rel; /* + * Skip executing a push's collected work (CE memsets/copies) while still + * applying its release; see the definition for the trade-off. + */ +extern bool gsp_sema_skip_ops; + +/* * Grace window (ms) an untranslatable GR GPFIFO entry is left pending before * the pump consumes it as stale. The GR push pages are pinned from guest * truth a moment after the channels appear; the window lets those pins land diff --git a/kernel/main.c b/kernel/main.c index 952daf1..590d956 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -2441,6 +2441,15 @@ module_param_named(sema_fake_rel, gsp_sema_fake_rel, bool, 0644); MODULE_PARM_DESC(sema_fake_rel, "Acknowledge unreadable CE releases directly (default 0)"); /* + * Skip executing the pushed work (CE memsets/copies) while still applying the + * semaphore releases. The client only observes releases; skipping the shadow + * writes removes the per-push execution cost that dominates the context-init + * latency budget. + */ +module_param_named(sema_skip_ops, gsp_sema_skip_ops, bool, 0644); +MODULE_PARM_DESC(sema_skip_ops, "Apply releases without executing pushed memsets (default 0)"); + +/* * Grace window (ms) an untranslatable GR entry stays pending before the pump * consumes it as stale, so a late push-buffer pin can still make it readable. */ |
