From efb096bc8a888a3e9931ae8011976ef7b4a1f577 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Fri, 2 Oct 2026 06:55:42 -0400 Subject: gsp-phys: P6b waves 1.5 and 2 - deferred release and hardware-authored guest copies - new default-off gsp_phys_work_defer_release: a forwarded guest push's releases are recorded and its GPFIFO entry is held (no consume, no GP_GET write, no counter publish/stall) until the work item publishes completion; the service thread then delivers the releases, with a fallback on failure/timeout (500 ms cap enforced every pump pass)/ pause/quiesce/channel-delete - new default-off gsp_phys_work_hw_primary: the software copy is skipped for forwarded ops, so the physical engine authors the data; a once-only software copy runs before the releases on any hardware failure or when the request cannot be queued - release-apply helpers extracted; exactly-once latches; channel-delete and teardown handling; counters and a work_guard state line - live: deferred-release run engaged=75 applied=75 timeouts=0 with the full smoke green; hardware-primary run req=100 ok=100 verify_ok=100 fallback=0 copy_skipped=119 copy_fail=0, smoke ALL OK 64/64 (guest read data the engine authored), with 19 fail-closed inline software fallbacks under single-inflight contention; a range-unregistered run proved the fallback (121 skipped copies, all recovered, smoke green) - defaults off; the software path and all existing guards unchanged --- kernel/gsp_phys_booter.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'kernel/gsp_phys_booter.c') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 90a0a27..69a749a 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -7595,6 +7595,35 @@ static int gsp_phys_state_show(struct seq_file *m, void *v) GSP_PHYS_RMCALL_GUEST_PT_PAGES * GSP_PHYS_RMCALL_GUEST_PT_LINES_PER_PAGE); } + { + /* + * P6b wave-1.5/wave-2 deferred guest releases and copy + * authorship: the sema service's held-release lifecycle plus + * the deferral/hardware-primary parameter state. pending is the + * current hold gauge (releases waiting on the forwarded copy); + * copy_skipped is the withheld software copies, copy_soft/ + * copy_fail the service-thread fallback copies; the rest are + * monotonic counters. + */ + u64 g_copy_skipped = 0, g_copy_soft = 0, g_copy_fail = 0; + u64 g_deferred = 0, g_applied = 0; + u64 g_fallback = 0, g_pending = 0, g_overflow = 0; + u64 g_engaged = 0, g_timeouts = 0, g_canceled = 0; + + gsp_sema_service_fwd_hold_stats(&g_copy_skipped, &g_copy_soft, + &g_copy_fail, &g_deferred, + &g_applied, &g_fallback, + &g_pending, &g_overflow, + &g_engaged, &g_timeouts, + &g_canceled); + seq_printf(m, + "work_guard: copy_skipped=%llu deferred=%llu applied=%llu fallback=%llu pending=%llu overflow=%llu engaged=%llu timeouts=%llu canceled=%llu defer_param=%u copy_soft=%llu copy_fail=%llu hw_primary_param=%u\n", + g_copy_skipped, g_deferred, g_applied, g_fallback, + g_pending, g_overflow, g_engaged, g_timeouts, + g_canceled, gsp_phys_work_defer_release_enabled(), + g_copy_soft, g_copy_fail, + gsp_phys_work_hw_primary_enabled()); + } { char guest_ram[512]; -- cgit v1.2.3