summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-30 15:30:23 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-30 15:30:23 -0400
commitb75ee50046d137a05dfd9f0cedeeda39c1d0b894 (patch)
tree0b80ec3bbf820d720d9caf45593fd0bdef146705
parent2f39ed717559f6f17e87ab10933fa7ff41a013c9 (diff)
downloadopen-iov-b75ee50046d137a05dfd9f0cedeeda39c1d0b894.tar.gz
open-iov-b75ee50046d137a05dfd9f0cedeeda39c1d0b894.zip
vgsp: svc_client_slot_sweep - per-pass (~2ms) clear of armed 0xffff completion slots for live beef channels; attempts now submit heavily (submissions 29->208, GP_PUT advancing put=14, sema-consume idx=94 put=95, ops_runs=2, copyent total=131068); client shim frames have content (mean_sum=60.8 nz_frac=0.2843); remaining wall = X presentation (DDX black fill va=0x120400000 vs client copy dst=0x4700000) - SESSION 153 r1024
-rw-r--r--kernel/gsp_sema_service.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 40c7f99..5483b4f 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -19683,6 +19683,89 @@ static void svc_notify_complete(struct nv_vgpu_device *vgpu,
}
/*
+ * SESSION 153-CONTINUED-42 (mission: converge the client-slot clear so a
+ * ladder attempt COMPLETES instead of recycling).
+ *
+ * CONT-41 found the protocol: glcore's submit pump arms a 0xffff sentinel in
+ * one of six u16 records just below the beef-family channel-notifier base
+ * (page+0x0e+i*16) and treats ANY other value as the completion. The kernel
+ * clear landed inside svc_notify_complete, but that hook only runs on passes
+ * where a completion is being processed - a client whose sentinel is armed
+ * while the pump has nothing else to complete still sat out its ~11 s
+ * deadline (r1023: attempt 2/3 had the clears logged and still retired
+ * submissions=0; only attempt 1 - cleared while its pushes were live -
+ * submitted). This sweep runs once per service pass for every live
+ * beef-family channel and clears ANY armed 0xffff in the six records, so
+ * every ladder phase releases within a pass regardless of what else the
+ * pump is doing. The bfef-family (X DDX member page) keeps its 0xffff
+ * delivered-error semantics and is not touched.
+ *
+ * Bounded: 16 channels per pass, first 96 clear events logged with the slot
+ * index (arm-phase tracing), then every 4096th. The log's slot index is
+ * what identifies which phase the client is in when it arms each record.
+ */
+static u32 svc_client_slot_log_n;
+static unsigned long svc_client_slot_at;
+
+static void svc_client_slot_sweep(struct nv_vgpu_device *vgpu)
+{
+ struct {
+ u32 h;
+ u64 base;
+ u32 as;
+ } tab[16];
+ unsigned long flags;
+ int i, n = 0;
+
+ if (!gsp_sema_client_slot)
+ return;
+ /* ~1 pass per tick while the pump runs tight; plenty for an ~11 s wait. */
+ if (time_before(jiffies, svc_client_slot_at))
+ return;
+ svc_client_slot_at = jiffies + msecs_to_jiffies(2);
+
+ spin_lock_irqsave(&svc.chan_lock, flags);
+ for (i = 0; i < SVC_MAX_CHANNELS && n < ARRAY_SIZE(tab); i++) {
+ struct svc_channel *c = &svc.chan[i];
+
+ if (!c->valid || c->vgpu != vgpu || !c->notifier_pa)
+ continue;
+ if ((c->h_object & 0xfffff000u) != 0xbeef0000u)
+ continue;
+ tab[n].h = c->h_object;
+ tab[n].base = c->notifier_pa;
+ tab[n].as = c->notifier_as;
+ n++;
+ }
+ spin_unlock_irqrestore(&svc.chan_lock, flags);
+
+ for (i = 0; i < n; i++) {
+ u64 page = tab[i].base & ~((u64)SEMA_PAGE_SIZE - 1);
+ int k;
+
+ for (k = 0; k < 6; k++) {
+ u64 pa = page + 0x0e + (u64)k * SVC_NOTIFY_SIZE;
+ u16 st = 0, z = 0;
+
+ if (pa + sizeof(st) > tab[i].base)
+ break;
+ if (svc_read_ap(vgpu, pa, tab[i].as, &st, sizeof(st)))
+ continue;
+ if (st != 0xffff)
+ continue;
+ if (svc_write_ap(vgpu, pa, tab[i].as, &z, sizeof(z)))
+ continue;
+ svc_client_slot_n++;
+ svc_client_slot_log_n++;
+ if (gsp_sema_dbg && (svc_client_slot_log_n <= 96 ||
+ (svc_client_slot_log_n % 4096) == 0))
+ pr_info("sema-chan: client-slot cleared(sweep) h=0x%x slot=%d pa=0x%llx n=%u\n",
+ tab[i].h, k, pa, svc_client_slot_log_n);
+ }
+ }
+}
+
+/*
* Run the work the guest has submitted on each registered channel.
*
* A submission is visible as GPPut moving ahead of our own read position in
@@ -37122,6 +37205,10 @@ static int svc_thread(void *arg)
vgpu = vgpus[g];
svc_shared_hold(vgpu); /* CONT.36: GL slot-word keeper */
+ /* CONT.42: release any armed client completion sentinel
+ * on every pass, not only when a completion is being
+ * processed (see svc_client_slot_sweep). */
+ svc_client_slot_sweep(vgpu);
svc_handle_probe(vgpu);
svc_handle_walk_probe(vgpu);
svc_handle_chan_dump(vgpu);