dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Tvrtko Ursulin <tursulin@ursulin.net>,
	Alex Deucher <alexdeucher@gmail.com>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	Dave Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>,
	David Francis <David.Francis@amd.com>
Subject: Re: Accelerator/GPU top
Date: Fri, 6 Feb 2026 14:29:17 +0100	[thread overview]
Message-ID: <15979898-873c-415e-9d3f-9ef751b2f4be@amd.com> (raw)
In-Reply-To: <a56b7e43-f499-4b52-bee1-15f7087057e0@ursulin.net>

On 2/6/26 10:58, Tvrtko Ursulin wrote:
> 
> On 05/02/2026 18:58, Alex Deucher wrote:
>> Has anyone given any thought on how to support something like top for
>> accelerators or GPUs?  We have fdinfo, but using fdinfo requires extra
>> privileges (CAP_SYS_PTRACE) and there is not a particularly efficient
>> way to even discover what processes are using the GPU.  There is the
>> clients list in debugfs, but that is also admin only.  Tools like ps
>> and top use /proc/<pid>/stat and statm.  Do you think there would be
>> an appetite for something like /proc/<pid>/drm/stat, statm, etc.?
>> This would duplicate much of what is in fdinfo, but would be available
>> to regular users.
> 
> In short yes, the inefficiency of the client discovery bugged me since the start of fdinfo and it was discussed a few times how to improve it.
> 
> AFAIR in those discussions a lists of clients outside of debugfs was mentioned, since that would allow the cost of discovery to not scale by the number of irrelevant processes. Something in proc was also mentioned but I guess for both no one had a strong enough drive to actually do it.

The fundamental problem is that Linux only tracks in one direction who has which file open, but not the reverse. In other words even an lsof /dev/dri/render* does nothing else than going over /proc and seeing who has opened what.

We can expose the list of open DRM connections and which process was the last user of each in sysfs (for example), but that is probably not accurate and might also expose information not every process should know about.

Regards,
Christian.

> 
> Challenge will be finding the threads to see if there were any interesting conclusions... The only one I can remember at the moment was this:
> 
> https://lore.kernel.org/dri-devel/20240403182951.724488-1-adrian.larumbe@collabora.com/
> 
> It looks this attempt died out due proposing a binary interface in sysfs.
> 
> In any case, I'd say it makes sense to do something.
> 
> Regards,
> 
> Tvrtko
> 
> P.S.
> Just in a case you did not see it, a generic tool exists as gputop in IGT but as you say, you can only see data for processes the user running the tool can read fdinfo stats of. And there some nicer tools feeding of the same data.
> 


      reply	other threads:[~2026-02-06 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 18:58 Accelerator/GPU top Alex Deucher
2026-02-05 19:16 ` Gregory Carter
2026-02-05 19:25 ` Natalie Vock
2026-02-05 20:35   ` Alex Deucher
2026-02-06 13:38   ` Christian König
2026-02-06 18:54     ` Maxime Schmitt
2026-02-08 16:12     ` Umio-Yasuno - coelacanth_dream
2026-02-06  9:58 ` Tvrtko Ursulin
2026-02-06 13:29   ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15979898-873c-415e-9d3f-9ef751b2f4be@amd.com \
    --to=christian.koenig@amd.com \
    --cc=David.Francis@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox