Re: [PATCH v4 4/4] gpu: nova-core: fix stack overflow in GSP memory allocation

From: Danilo Krummrich

Date: Tue Mar 10 2026 - 13:40:43 EST


On Mon Mar 9, 2026 at 5:34 PM CET, Tim Kovalenko via B4 Relay wrote:
> From: Tim Kovalenko <tim.kovalenko@xxxxxxxxx>
>
> The `Cmdq::new` function was allocating a `PteArray` struct on the stack
> and was causing a stack overflow with 8216 bytes.
>
> Modify the `PteArray` to calculate and write the Page Table Entries
> directly into the coherent DMA buffer one-by-one. This reduces the stack
> usage quite a lot.
>
> Signed-off-by: Tim Kovalenko <tim.kovalenko@xxxxxxxxx>

Applied to drm-rust-fixes, thanks!

--- commit ---

commit c7940c8bf215b9dc6211781c77ce80e76982a723
Author: Tim Kovalenko <tim.kovalenko@xxxxxxxxx>
Date: Mon Mar 9 12:34:21 2026 -0400

gpu: nova-core: fix stack overflow in GSP memory allocation

The `Cmdq::new` function was allocating a `PteArray` struct on the stack
and was causing a stack overflow with 8216 bytes.

Modify the `PteArray` to calculate and write the Page Table Entries
directly into the coherent DMA buffer one-by-one. This reduces the stack
usage quite a lot.

Reported-by: Gary Guo <gary@xxxxxxxxxxx>
Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/509436-Nova/topic/.60Cmdq.3A.3Anew.60.20uses.20excessive.20stack.20size/near/570375549
Link: https://lore.kernel.org/rust-for-linux/CANiq72mAQxbRJZDnik3Qmd4phvFwPA01O2jwaaXRh_T+2=L-qA@xxxxxxxxxxxxxx/
Fixes: f38b4f105cfc ("gpu: nova-core: Create initial Gsp")
Acked-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
Signed-off-by: Tim Kovalenko <tim.kovalenko@xxxxxxxxx>
Link: https://patch.msgid.link/20260309-drm-rust-next-v4-4-4ef485b19a4c@xxxxxxxxx
[ * Use PteArray::entry() in LogBuffer::new(),
* Add TODO comment to use IoView projections once available,
* Add PTE_ARRAY_SIZE constant to avoid duplication.

- Danilo ]
Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>