[PATCH v4 0/4] Fixes the stack overflow

From: Tim Kovalenko via B4 Relay

Date: Mon Mar 09 2026 - 12:44:33 EST



---
Changes in v4:
- Rebase on top of projection changes
- Use index projection when writing PTEs
- Keep PteArray, as discussed in V2, and move entry calculation there
- Avoid stack allocation by writing PTEs directly to DMA memory

- Link to v3: https://lore.kernel.org/r/20260217-drm-rust-next-v3-1-9e7e95c597dc@xxxxxxxxx

Changes in v3:
- Addressed the comments and re-instated the PteArray type.
- PteArray now uses `init` instead of `new` where it writes to `self`
page by page.
- PteArray just needs a pte pointer obtained from the `gsp_mem.as_slice_mut`.

I hope I understood everything in the V2 email chain and implemented it correctly :)

- Link to v2: https://lore.kernel.org/r/20260213-drm-rust-next-v2-1-aa094f78721a@xxxxxxxxx

Changes in v2:
- Missed a code formatting issue.
- Link to v1: https://lore.kernel.org/r/20260212-drm-rust-next-v1-1-409398b12e61@xxxxxxxxx

---
Gary Guo (3):
rust: ptr: add `KnownSize` trait to support DST size info extraction
rust: ptr: add projection infrastructure
rust: dma: use pointer projection infra for `dma_{read,write}` macro

Tim Kovalenko (1):
gpu: nova-core: fix stack overflow in GSP memory allocation

drivers/gpu/nova-core/gsp.rs | 48 ++++---
drivers/gpu/nova-core/gsp/boot.rs | 2 +-
drivers/gpu/nova-core/gsp/cmdq.rs | 23 ++-
rust/kernel/dma.rs | 114 +++++++--------
rust/kernel/lib.rs | 4 +
rust/kernel/ptr.rs | 30 +++-
rust/kernel/ptr/projection.rs | 294 ++++++++++++++++++++++++++++++++++++++
samples/rust/rust_dma.rs | 30 ++--
scripts/Makefile.build | 4 +-
9 files changed, 443 insertions(+), 106 deletions(-)
---
base-commit: dd8a93dafe6ef50b49d2a7b44862264d74a7aafa
change-id: 20260212-drm-rust-next-beb92aee9d75

Best regards,
--
Tim Kovalenko <tim.kovalenko@xxxxxxxxx>