Skip to contentSkip to conversation

rust: drm: enable standard fdinfo for Rust drivers

PATCH Applied Peder Bergan 2 participants 2 messages Nov 26

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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. Rust DRM does not yet expose the optional driver-specific statistics hook.

---
Danilo, VTABLE.fops points to UnregisteredDevice::FOPS. Procfs calls FOPS.show_fdinfo, so this patch installs drm_show_fdinfo there. The helper calls VTABLE.show_fdinfo when the driver supplies additional statistics.

Matt Mireles reported the missing fdinfo fields on an Asahi kernel and suggested using this helper.

Janne Grunau tested v1 with the downstream Asahi driver on Apple silicon.

OpenAI Codex assisted with coding and testing.
---
Changes in v2:
- Rebase onto drm-rust-next and set the callback in UnregisteredDevice::FOPS
now that the file operations have moved to drm::device.
- Drop the Fixes tag and clarify that Rust DRM has yet to expose the
optional driver statistics hook.
- Add the Reviewed-by and Tested-by tags from v1.
- Link to v1: https://patch.msgid.link/[email protected]

---
 rust/kernel/drm/device.rs | 1 +
 1 file changed, 1 insertion(+)
rust/kernel/drm/device.rs +1 -0
index 1c5b0abb492be..c460ba3706bf9 100644
@@ -273,6 +273,7 @@ extern "C" fn fops_open(inode: *mut bindings::inode, filp: *mut 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: 4325f4aad9727a6e8e7f10c5d2ebf490470cf938
change-id: 20261119-fix-drm-rust-fdinfo-8e17f71dd9c3

Best regards,

Signature · 1 line
Peder Bergan <[email protected]>
maintainer Applied
#1 lore raw
Quoted 1 line · Peder Bergan

[PATCH v2] rust: drm: enable standard fdinfo for Rust drivers

Applied, thanks!

Branch: drm-rust-next
Tree: https://gitlab.freedesktop.org/drm/rust/kernel.git

[1/1] rust: drm: enable standard fdinfo for Rust drivers

      commit: 02efea879e87

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is queued up for the upcoming merge window for the next major kernel release.