From f6fe05c9322ae55b0c5e07cf3ab60e8b510f1b41 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Fri, 9 Oct 2026 09:59:12 -0400 Subject: vgsp-sema: re-arm diagnostic budgets per session and log the release-apply silent exits (ISSUE-0002 diagnosis) --- kernel/gsp_sema_service.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'kernel') diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index e127a4a..f46158e 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -4599,8 +4599,20 @@ static void svc_counter_release_apply(struct nv_vgpu_device *vgpu, u32 h, int i; u32 dbg = 0; - if (!h || !payload) + if (!h || !payload) { + /* + * A decoded release with a zero payload is dropped here; log + * it (bounded per session) so a client waiting on a value + * that never arrives is not invisible in the trace. + */ + if (gsp_sema_dbg && !payload && + svc.counter_rel_dbg < 256 && sem_va >= SVC_VAS_FLOOR) { + svc.counter_rel_dbg++; + pr_info("sema-chan: rel-apply h=0x%x va=0x%llx pay=0 -> dropped\n", + h, sem_va); + } return; + } /* * The injected pin for the counter page can land a moment after the @@ -4653,12 +4665,12 @@ static void svc_counter_release_apply(struct nv_vgpu_device *vgpu, u32 h, } } spin_unlock_irqrestore(&svc.chan_lock, flags); - if (gsp_sema_dbg && svc.counter_rel_dbg < 96) { + if (gsp_sema_dbg && svc.counter_rel_dbg < 256) { svc.counter_rel_dbg++; pr_info("sema-chan: rel-apply h=0x%x va=0x%llx pay=%u -> slot pending\n", h, sem_va, payload); } - } else if (gsp_sema_dbg && svc.counter_noslot_dbg < 16) { + } else if (gsp_sema_dbg && svc.counter_noslot_dbg < 64) { svc.counter_noslot_dbg++; pr_info("sema-chan: rel-apply h=0x%x va=0x%llx pay=%u -> no slot registered\n", h, sem_va, payload); @@ -4667,7 +4679,7 @@ static void svc_counter_release_apply(struct nv_vgpu_device *vgpu, u32 h, } if (svc_read_ap(vgpu, pa, SVC_APERTURE_SYS, &cur, sizeof(cur))) { - if (gsp_sema_dbg && svc.counter_rel_dbg < 32) { + if (gsp_sema_dbg && svc.counter_rel_dbg < 256) { svc.counter_rel_dbg++; pr_info("sema-chan: rel-apply h=0x%x pa=0x%llx pay=%u -> read failed\n", h, pa, payload); @@ -4685,7 +4697,7 @@ static void svc_counter_release_apply(struct nv_vgpu_device *vgpu, u32 h, else skip = payload <= cur || payload - cur > 0x100000; if (skip) { - if (gsp_sema_dbg && svc.counter_rel_dbg < 32) { + if (gsp_sema_dbg && svc.counter_rel_dbg < 256) { svc.counter_rel_dbg++; pr_info("sema-chan: rel-apply h=0x%x pa=0x%llx pay=%u cur=%u -> skip\n", h, pa, payload, cur); @@ -4693,13 +4705,19 @@ static void svc_counter_release_apply(struct nv_vgpu_device *vgpu, u32 h, return; } nv = inc ? cur + payload : payload; - if (svc_write_ap(vgpu, pa, SVC_APERTURE_SYS, &nv, sizeof(nv))) + if (svc_write_ap(vgpu, pa, SVC_APERTURE_SYS, &nv, sizeof(nv))) { + if (gsp_sema_dbg && svc.counter_rel_dbg < 256) { + svc.counter_rel_dbg++; + pr_info("sema-chan: rel-apply h=0x%x pa=0x%llx pay=%u cur=%u -> write failed\n", + h, pa, payload, cur); + } return; + } svc.releases_applied++; svc.counter_rel_applied++; svc.gr_rel_applied++; svc.post_hint_until = jiffies + 10 * HZ; - if (gsp_sema_dbg && svc.counter_rel_dbg < 32) { + if (gsp_sema_dbg && svc.counter_rel_dbg < 256) { svc.counter_rel_dbg++; pr_info("sema-chan: rel-apply h=0x%x pa=0x%llx pay=%u cur=%u -> written\n", h, pa, payload, cur); @@ -4781,7 +4799,7 @@ static void svc_counter_flush_pending(struct nv_vgpu_device *vgpu, svc.counter_rel_applied++; svc.gr_rel_applied++; svc.post_hint_until = jiffies + 10 * HZ; - if (gsp_sema_dbg && svc.counter_rel_dbg < 96) { + if (gsp_sema_dbg && svc.counter_rel_dbg < 256) { svc.counter_rel_dbg++; pr_info("sema-chan: rel-flush h=0x%x pa=0x%llx pay=%u cur=%u -> written\n", ch->h_object, pa, payload, cur); @@ -6403,6 +6421,17 @@ static void svc_session_flush(void) svc.ipin_n = 0; memset(svc_cnt_der, 0, sizeof(svc_cnt_der)); svc_cnt_der_n = 0; + /* + * Re-arm the diagnostic log budgets per session. The first client of + * a boot would otherwise spend every budget and the next session's + * release path is invisible in exactly the runs that need diagnosis + * (ISSUE-0002: the second client hung with zero rel-apply lines + * because the counters were already exhausted by the first client). + */ + svc.counter_rel_dbg = 0; + svc.counter_noslot_dbg = 0; + svc.sem256_log = 0; + svc.xfer_raw_log = 0; memset(svc_hot, 0, sizeof(svc_hot)); memset(svc_retry_q, 0, sizeof(svc_retry_q)); memset(svc_pool_pa, 0, sizeof(svc_pool_pa)); -- cgit v1.2.3