On 19/02/2026 12:56, Danilo Krummrich wrote:
On Thu Feb 19, 2026 at 1:44 PM CET, Matthew Auld wrote:
On 19/02/2026 11:14, Danilo Krummrich wrote:
On Thu Feb 19, 2026 at 11:38 AM CET, Matthew Auld wrote:
On 19/02/2026 10:16, Danilo Krummrich wrote:
On Mon Feb 16, 2026 at 12:19 PM CET, Koen Koning wrote:
Use subsys_initcall instead of module_init for the GPU buddy allocator,
so its initialization code runs before any gpu drivers.
Otherwise, a built-in driver that tries to use the buddy allocator will
run into a kernel NULL pointer dereference because slab_blocks is
uninitialized.
Specifically, this fixes drm/xe (as built-in) running into a kernel
panic during boot, because it uses buddy during device probe.
I just noticed that this patch was sent twice, and I posted my feedback on [1]
-- pasting it here as well.
Fixes: ba110db8e1bc ("gpu: Move DRM buddy allocator one level up (part two)")
This Fixes: tag seems wrong. How is this code move related to this problem?
This popped up as a very recent regression for us internally. It looks
like it worked before since link order ensured drm_buddy came before all
the driver code. With above commit the link order changed and became
drm/ and then buddy. See [1] also, which is maybe clearer to see this.
I see, I think this would be a good hint for the commit message. :)
However, I think it was never meant to rely on a build system implementation
detail, nor would this be correct. So, I think this should add both Fixes: tags.
Yeah, I'm really not sure tbh. From a quick grep there do seem to be
other users relying on this:
drm/drm_drv.c:1274:module_init(drm_core_init);
drm/scheduler/sched_fence.c:238:module_init(drm_sched_fence_slab_init);
The sched one looks identical with the slab thing. Do these need to be
fixed also?
Yes, those should be fixed as well.
Also note that module_init() compiles down to device_initcall() when built-in,
i.e. the initcall stage that is mainly for drivers, not for subsystem code.
Do you want to send a fix for thise as well?
Koen will send something.
Whether it should be backported is a different question though, as it seems to
work by accident in previous versions, i.e. it is only a "potential bug".
My personal opinion is that it should be backported either way, however that's
ultimately up to the stable team.
- Danilo
[1]
https://lore.kernel.org/intel-xe/[email protected]/
This should rather be:
Fixes: 6387a3c4b0c4 ("drm: move the buddy allocator from i915 into common drm")
Also, please add:
Cc: [email protected]
Cc: Joel Fernandes <[email protected]>
Cc: Dave Airlie <[email protected]>
Cc: [email protected]
Cc: Peter Senna Tschudin <[email protected]>
Cc: Matthew Auld <[email protected]>
Signed-off-by: Koen Koning <[email protected]>
[1] https://lore.kernel.org/all/[email protected]/