summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-15 00:55:33 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-15 00:55:33 -0400
commit8479659ce21bfae6639194d533ca925ba9fdd9b6 (patch)
tree17d5200ba3a9ed8f38cf25f8e83027196b29758a /kernel
parent754bbbe8183c0a9ece49bd476b2f4a8b265c4b79 (diff)
downloadopen-iov-8479659ce21bfae6639194d533ca925ba9fdd9b6.tar.gz
open-iov-8479659ce21bfae6639194d533ca925ba9fdd9b6.zip
vgsp-gr: retirement wait - correct footprint (exclude launch pages) + adaptive exits
- Footprint: exclude data entries whose guest VA is a forwarded launch page (qmd_word pages) before picking out_base/out_pages. The fill relocates the launch's own param/bank pages as high-VA candidates, which made out_pages the whole 205-page budget and forced the full 1.5 s wait on every launch (r147: '64/205 pages changed ... (TIMEOUT)' on green matmul). - Adaptive exits: no writes at all after 60 ms (identical-rewrite benchmark launches / no-output footprints) or a partial count settled for 3 polls (masked kernels) end the wait early; genuinely late writes are still caught. Log now carries the reason suffix (no suffix = full footprint). Live evidence from r147 with the first cut: the exact failing order mail->matmul->smiley ran green->green->green (smiley recovered to 32/205 changed, C window written; earlier boots showed 0-8 changed and STATUS FAIL). victory_math/vector_add still fail on the >256 KB per-operand window cap (chunked data path is the next wall, not this class).
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_phys_booter.c83
1 files changed, 74 insertions, 9 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index af7befc..f603c10 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -16619,9 +16619,34 @@ gsp_phys_gr_output_retire_wait(const struct gsp_phys_gr_submit *req,
u64 out_base = 0;
u32 out_pages = 0, di;
- for (di = 0; di < req->n_data; di++)
+ /*
+ * The output footprint is the contiguous descending reloc run from
+ * the highest reloc_va that belongs to a kernel OPERAND. The fill
+ * also relocates the launch's own param/bank pages (they appear as
+ * high-VA candidates in the push), and those would otherwise make
+ * out_base the top of the window and out_pages the whole budget -
+ * the r147 first cut waited the full 1.5 s on every launch because
+ * of it. Exclude any data entry whose guest VA is one of the
+ * forwarded launch pages (qmd_word pages; 0xffffffff marks the
+ * non-QMD forwarded pages).
+ */
+ for (di = 0; di < req->n_data; di++) {
+ u32 pj;
+ bool launch_page = false;
+
+ for (pj = 0; pj < req->n_pages; pj++) {
+ if (req->pages[pj].qmd_word == 0xffffffffu)
+ continue;
+ if (req->pages[pj].guest_va == req->data[di].va) {
+ launch_page = true;
+ break;
+ }
+ }
+ if (launch_page)
+ continue;
if (req->data[di].reloc_va > out_base)
out_base = req->data[di].reloc_va;
+ }
if (out_base) {
for (;;) {
u64 want = out_base -
@@ -16629,11 +16654,30 @@ gsp_phys_gr_output_retire_wait(const struct gsp_phys_gr_submit *req,
u32 k;
bool hit = false;
- for (k = 0; k < req->n_data; k++)
- if (req->data[k].reloc_va == want) {
- hit = true;
- break;
+ for (k = 0; k < req->n_data; k++) {
+ if (req->data[k].reloc_va != want)
+ continue;
+ /* launch pages were excluded from out_base */
+ {
+ u32 pj;
+ bool lp = false;
+
+ for (pj = 0; pj < req->n_pages; pj++) {
+ if (req->pages[pj].qmd_word ==
+ 0xffffffffu)
+ continue;
+ if (req->pages[pj].guest_va ==
+ req->data[k].va) {
+ lp = true;
+ break;
+ }
+ }
+ if (lp)
+ continue;
}
+ hit = true;
+ break;
+ }
if (!hit ||
out_pages >= GSP_PHYS_RMCALL_GR_MAIL_SLOT)
break;
@@ -16646,7 +16690,8 @@ gsp_phys_gr_output_retire_wait(const struct gsp_phys_gr_submit *req,
out_pages = GSP_PHYS_RMCALL_GR_MAIL_SLOT;
if (out_pages >= 2u) {
unsigned long wait_start = jiffies;
- u32 changed = 0, iter;
+ u32 changed = 0, prev = 0xffffffffu, iter;
+ const char *why = " (TIMEOUT)";
for (iter = 0; iter < 300u; iter++) {
u32 j;
@@ -16669,14 +16714,34 @@ gsp_phys_gr_output_retire_wait(const struct gsp_phys_gr_submit *req,
if (csum != csum_in[bi])
changed++;
}
- if (changed >= out_pages)
+ if (changed >= out_pages) {
+ why = "";
break;
+ }
+ /*
+ * Adaptive exits: no write at all after 60 ms means the
+ * engine either rewrote identical bytes (a repeated
+ * benchmark launch) or produced no output for this
+ * footprint; a partial count that stops growing for
+ * three polls means the stores have settled (masked /
+ * partial-output kernels). Both avoid paying the full
+ * 1.5 s on every launch while still catching genuinely
+ * late writes.
+ */
+ if (iter >= 12u && changed == 0) {
+ why = " (no writes)";
+ break;
+ }
+ if (changed > 0 && changed == prev && iter >= 24u) {
+ why = " (settled)";
+ break;
+ }
+ prev = changed;
usleep_range(4000, 6000);
}
pr_info("vgsp-gr: output retirement wait: %u/%u pages changed after %u ms%s\n",
changed, out_pages,
- jiffies_to_msecs(jiffies - wait_start),
- (changed >= out_pages) ? "" : " (TIMEOUT)");
+ jiffies_to_msecs(jiffies - wait_start), why);
}
}