]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
gpu: nova-core: fix stack overflow in GSP memory allocation
authorTim Kovalenko <tim.kovalenko@proton.me>
Mon, 9 Mar 2026 16:34:21 +0000 (12:34 -0400)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 10 Mar 2026 17:29:14 +0000 (18:29 +0100)
commitc7940c8bf215b9dc6211781c77ce80e76982a723
tree07b6cb3c956fa664f5580cf864cdcf704c1b4581
parent4da879a0d3fd170a70994b73baa554c6913918b5
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@garyguo.net>
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@mail.gmail.com/
Fixes: f38b4f105cfc ("gpu: nova-core: Create initial Gsp")
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Tim Kovalenko <tim.kovalenko@proton.me>
Link: https://patch.msgid.link/20260309-drm-rust-next-v4-4-4ef485b19a4c@proton.me
[ * 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@kernel.org>
drivers/gpu/nova-core/gsp.rs
drivers/gpu/nova-core/gsp/cmdq.rs