summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_rm_emulation.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-22 09:43:22 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-22 09:43:22 -0400
commit60da11fe771968bbc0cc65b8f629cc5e6b3f44a1 (patch)
tree99878e4285e9edcab697d4d2569161f70c8642d1 /kernel/gsp_rm_emulation.c
parent9b891254b05e9e46f27b8ff53decfbbb429d1cc4 (diff)
downloadopen-iov-60da11fe771968bbc0cc65b8f629cc5e6b3f44a1.tar.gz
open-iov-60da11fe771968bbc0cc65b8f629cc5e6b3f44a1.zip
host stability: BAR3 shadow + skip submodule nvidia + teardown-safe garbage handler
Root causes of host GSP crash (WPR2 stuck, 'unexpected WPR2 already up'): 1. stack_manager load-nvidia tried to load our submodule nvidia.ko (610.57.04-base) alongside/over apt nvidia 570.211.01 -> GSP crash during driver conflict. Fix: skip submodule when apt nvidia is already loaded (not needed for QEMU). 2. BAR3 (32MB instance memory window) was mapped to the physical GPU's real BAR3, so guest BAR3 writes could corrupt the host GPU's instance memory. Fix: vzalloc'd shadow buffer (like BAR1 emulated vidmem), per-page mmap. 3. GSP-RM garbage element handler declared GSP death on teardown queue garbage, preventing driver cleanup frees from completing. Fix: stop polling quietly, let Booter-unload kick handle reset. Verified: full lifecycle (load, mdev create, QEMU guest boot, guest probe, mdev remove, unload, reload) with host nvidia-smi (apt 570.211.01) stable throughout. No GSP crash, no WPR2 stuck, no module unload hang.
Diffstat (limited to 'kernel/gsp_rm_emulation.c')
-rw-r--r--kernel/gsp_rm_emulation.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/gsp_rm_emulation.c b/kernel/gsp_rm_emulation.c
index 2d38829..44e716b 100644
--- a/kernel/gsp_rm_emulation.c
+++ b/kernel/gsp_rm_emulation.c
@@ -1530,16 +1530,17 @@ static void gsp_rm_poll_commands(struct gsp_emu_context *ctx)
if (signature != GSPRM_RPC_SIGNATURE || elem_count == 0 ||
elem_count > rm->cmd_msgcount) {
- /* The driver always writes a valid element BEFORE
- * bumping writePtr. Garbage content means the queue
- * buffer is stale (freed and reused by the guest
- * after unload/crash) - declare the emulated GSP
- * dead so the next probe re-boots. */
- nv_vgpu_warn(ctx->vgpu, "GSPRM: garbage element idx=%u sig=0x%x elemCount=%u fn=%u, GSP boot declared dead",
+ /* Garbage element: could be teardown (driver stopped
+ * writing valid elements after UNLOADING_GUEST_DRIVER/
+ * FREE sequence) or genuine queue death. Don't declare
+ * death here - stop polling quietly and let the
+ * Booter-unload kick (SEC2 CPUCTL) trigger the reset
+ * via gsp_emu_clear_boot_state. This allows the
+ * driver's cleanup frees to complete. */
+ nv_vgpu_info(ctx->vgpu, "GSPRM: garbage element idx=%u sig=0x%x elemCount=%u fn=%u, stopping poll (teardown?)",
rm->cmd_read, signature, elem_count,
hdr->function);
kfree(elem);
- gsp_emu_clear_boot_state(ctx, "garbage GSP-RM queue");
return;
}