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_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. Closes: https://github.com/Rust-for-Linux/linux/issues/1266 Tested-by: Janne Grunau <[email protected]> Reviewed-by: Janne Grunau <[email protected]> Reviewed-by: Gary Guo <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Peder Bergan <[email protected]> --- 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(+) diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs index 1c5b0abb492be..c460ba3706bf9 100644 --- a/rust/kernel/drm/device.rs +++ b/rust/kernel/drm/device.rs @@ -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, -- Peder Bergan <[email protected]>
