From 41ee27eb4581341d87a4701b61f1ef8735fd1fc2 Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Wed, 11 Nov 2026 19:53:54 +0100 Subject: [PATCH] drm/asahi: G16: run each probe phase in its own stack frame Loading the GPU module on the J713 overflows the probe's stack: Insufficient stack space to handle exception! pc : ...g16...Firmware13start_backend+0x54 [aurora] Kernel panic - not syncing: kernel stack overflow Gpu::new() runs admission, the firmware start and the backend start in turn. Built for the J713, the compiler now inlines the first two into it, a 17 KB frame, and calls the third, which has 14 KB of its own. Below the probe path that no longer fits in the 32 KB stack. Before the last G16 changes the backend start was inlined as well: one 18 KB frame. Keep all three out of line, so each phase's temporaries are gone when it returns. Measured from the frames in aurora.o, the deepest path below the probe goes from 34.5 KB to 24.9 KB (26.1 KB before those changes). The backend start's own frame, mostly whole-Firmware moves, is the next thing to shrink. Assisted-by: LLM Signed-off-by: Bartosz Nitka --- drivers/gpu/drm/asahi/g16/boot.rs | 2 ++ drivers/gpu/drm/asahi/g16/mod.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/drm/asahi/g16/boot.rs b/drivers/gpu/drm/asahi/g16/boot.rs index 509ed3368df77..2de07794d0087 100644 --- a/drivers/gpu/drm/asahi/g16/boot.rs +++ b/drivers/gpu/drm/asahi/g16/boot.rs @@ -439,6 +439,7 @@ impl Orphan { } /// Probe-time admission. +#[inline(never)] pub(crate) fn admit( pdev: &platform::Device>, _dev: &AsahiDrmDevice, @@ -658,6 +659,7 @@ fn run( } /// Brings the firmware to READY. +#[inline(never)] pub(crate) fn start( admitted: Admitted, dev: &AsahiDrmDevice, diff --git a/drivers/gpu/drm/asahi/g16/mod.rs b/drivers/gpu/drm/asahi/g16/mod.rs index 41fdad4e4cdaa..b62674726d49b 100644 --- a/drivers/gpu/drm/asahi/g16/mod.rs +++ b/drivers/gpu/drm/asahi/g16/mod.rs @@ -437,6 +437,10 @@ impl Gpu { impl Firmware { /// Builds the graphs and the engine after READY. On failure the firmware stays at READY, /// retained as an orphan of `shared`. + /// + /// Out of line, like [`boot::admit`] and [`boot::start`]: each of [`Gpu::new`]'s phases + /// has a large frame, and the probe's stack holds them only one at a time. + #[inline(never)] fn start_backend( dev: &AsahiDrmDevice, booted: boot::Booted,