rust: drm: enable standard fdinfo for Rust drivers
Subsystems (4)
PATCH 1/1 rust: drm: enable standard fdinfo for Rust drivers
DRM monitoring tools use drm-driver and drm-client-id in procfs fdinfo to identify DRM clients. The common Rust DRM file operations leave show_fdinfo unset, so these entries are missing for those clients.
Set show_fdinfo to drm_show_fdinfo. The DRM core helper emits the standard client information and calls the separate driver statistics hook if the driver provides one.
---
Matt Mireles reported the missing fdinfo fields on an Asahi kernel and suggested using this helper.
The x86-64 LLVM=1 CLIPPY=1 build adds the drm_show_fdinfo callback to nova-drm.ko's file operations table.
The pending move of the file operations into drm::device [1] should carry this assignment into UnregisteredDevice::FOPS.
[1] https://lore.kernel.org/dri-devel/[email protected]/
OpenAI Codex assisted with coding and testing.
--- rust/kernel/drm/gem/mod.rs | 1 + 1 file changed, 1 insertion(+)
rust/kernel/drm/gem/mod.rs +1 -0
@@ -388,6 +388,7 @@ pub(super) const fn create_fops(owner: *mut bindings::module) -> bindings::file_ fops.read =Some (bindings::drm_read); fops.llseek =Some (bindings::noop_llseek); fops.mmap =Some (bindings::drm_gem_mmap); + fops.show_fdinfo =Some (bindings::drm_show_fdinfo); fops.fop_flags = bindings::FOP_UNSIGNED_OFFSET ; fops
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261119-fix-drm-rust-fdinfo-8e17f71dd9c3
Best regards,
Signature · 1 line
Peder Bergan <[email protected]>
Quoted 9 lines · On Thu, Nov 19, 2026 at 10:48:47AM +0100, Peder Bergan via B4 Relay wrote:
From: Peder Bergan <[email protected]>
DRM monitoring tools use drm-driver and drm-client-id in procfs fdinfo to identify DRM clients. The common Rust DRM file operations leave
show_fdinfounset, so these entries are missing for those clients.Set
show_fdinfotodrm_show_fdinfo. The DRM core helper emits the standard client information and calls the separate driver statistics hook if the driver provides one.
None of the drivers (upstream and out of tree) set drm_driver.show_fdinfo though as they can't yet so only drm-driver and drm-client-id will be printed.
I guess this is ok and if a driver wants or needs opt-out of show_fdinfo it can be made optional then. Note that most C drivers don't set this either only the main GPU drivers and a few npu drivers.
Tested on Apple silicon system with the Asahi downstream driver.
Quoted 1 line
Fixes c284d3e42338 ("rust: drm: gem: Add GEM object abstraction")
I don't think the Fixes: tag is justified. This is an optional callback and the majority of C drivers (in numbers) don't set it. Even if it sets it won't provide much useful information for any existing Rust driver.
thanks,
Janne
Quoted 6 lines · On Thu Nov 19, 2026 at 9:48 AM GMT, Peder Bergan via B4 Relay wrote:
From: Peder Bergan <[email protected]>
DRM monitoring tools use drm-driver and drm-client-id in procfs fdinfo to identify DRM clients. The common Rust DRM file operations leave
show_fdinfounset, so these entries are missing for those clients.
Quoted 7 lines
Set
show_fdinfotodrm_show_fdinfo. The DRM core helper emits the standard client information and calls the separate driver statistics hook if the driver provides one.Fixes c284d3e42338 ("rust: drm: gem: Add GEM object abstraction")Signed-off-by Peder Bergan <[email protected]>
I agree with Janne that the "Fixes" tag is not warranted.
Best,
Gary
Quoted 16 lines
---
Matt Mireles reported the missing fdinfo fields on an Asahi kernel and suggested using this helper.The x86-64 LLVM=1 CLIPPY=1 build adds the
drm_show_fdinfocallback to nova-drm.ko's file operations table.The pending move of the file operations into
drm::device[1] should carry this assignment intoUnregisteredDevice::FOPS.[1] https://lore.kernel.org/dri-devel/[email protected]/
OpenAI Codex assisted with coding and testing.
--- rust/kernel/drm/gem/mod.rs | 1 + 1 file changed, 1 insertion(+)
Quoted 11 lines · Peder Bergan
DRM monitoring tools use drm-driver and drm-client-id in procfs fdinfo to identify DRM clients. The common Rust DRM file operations leave
show_fdinfounset, so these entries are missing for those clients.Set
show_fdinfotodrm_show_fdinfo. The DRM core helper emits the standard client information and calls the separate driver statistics hook if the driver provides one.Fixes c284d3e42338 ("rust: drm: gem: Add GEM object abstraction")Signed-off-by Peder Bergan <[email protected]>
Alice
Thanks for the reviews, and thanks Janne for testing on Asahi. I agree that the Fixes tag should go.
Danilo, I’ve prepared a v2 against drm-rust-next with the callback in UnregisteredDevice::FOPS. Would you like me to send it?
Peder
Quoted 16 lines · Alice Ryhl
Quoted 11 lines · Peder Bergan
DRM monitoring tools use drm-driver and drm-client-id in procfs fdinfo to identify DRM clients. The common Rust DRM file operations leave
show_fdinfounset, so these entries are missing for those clients.Set
show_fdinfotodrm_show_fdinfo. The DRM core helper emits the standard client information and calls the separate driver statistics hook if the driver provides one.Fixes c284d3e42338 ("rust: drm: gem: Add GEM object abstraction")Signed-off-by Peder Bergan <[email protected]>Reviewed-by Alice Ryhl <[email protected]>Alice