From 13c07f7585c71bb75870d2a25475b4c9401a57fc Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Thu, 24 Sep 2026 10:48:08 -0400 Subject: kernel: enlarge the pin table and its probe window; tools: bridge client mappings into the service The pin table became the primary VA->PA store once push-buffer regions and bridged client mappings started adding thousands of pages per boot; at 8192 slots with an 8-probe window, inserts were silently dropped and lookups missed at half load. 32768 slots and a 32-probe window keep the mapped set intact. tools/guest-diag/{guest_pmap_all.py,bridge_sems.sh} translate the CUDA client's /dev/nvidia* mappings through the guest's own pagemap and inject each present page into the service as a sysmem pin. With the client's semaphore pages pinned the service applies their releases into the page the client polls (verified: applied 67 -> 109, misses stop growing for those VAs), where before every write went to the vidmem shadow. --- kernel/gsp_sema_service.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'kernel/gsp_sema_service.c') diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index 34b9ffd..168e017 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -157,7 +157,14 @@ static u32 svc_map_hash[SEMA_MAP_MAX * 2]; * (debug injection) and that must not be evicted by the learned cache, which * is content-addressed and gets thrashed by the lookup stream. */ -#define SVC_PIN_SLOTS 8192 +#define SVC_PIN_SLOTS 32768 +/* + * Linear-probe window for the pin table. The table is now the primary + * VA->PA store (push-buffer regions and bridged client mappings add + * thousands of pages at a time), so a short window would silently drop + * inserts and mis-resolve lookups once it is half full. + */ +#define SVC_PIN_PROBE 32 struct svc_pin { u64 va_page; @@ -965,7 +972,7 @@ static int svc_pin_lookup(u64 va, u64 *pa, int *ap) u32 h = (u32)((page >> SEMA_PAGE_SHIFT) * 2654435761u) & mask; u32 probe; - for (probe = 0; probe < 8; probe++) { + for (probe = 0; probe < SVC_PIN_PROBE; probe++) { struct svc_pin *p = &svc.pin[(h + probe) & mask]; if (!p->va_page) @@ -986,7 +993,7 @@ static void svc_pin_store(u64 va, u64 pa, int ap) u32 h = (u32)((page >> SEMA_PAGE_SHIFT) * 2654435761u) & mask; u32 probe; - for (probe = 0; probe < 8; probe++) { + for (probe = 0; probe < SVC_PIN_PROBE; probe++) { struct svc_pin *p = &svc.pin[(h + probe) & mask]; if (!p->va_page || p->va_page == page) { -- cgit v1.2.3