<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:15pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div dir="ltr">
<div></div>
<div>
<div>Maybe we could try to standardize how the different submission ring usage gets exposed in the fdinfo? We went the simple way of just adding name and index, but if someone has a suggestion on how else we could format them so there is commonality across
vendors we could just amend those.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">I’d really like to have the process managers tools display GPU usage regardless of what vendor is installed.</div>
<div><br>
</div>
<div class="ms-outlook-ios-signature"></div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Daniel Vetter <daniel@ffwll.ch><br>
<b>Sent:</b> Monday, May 17, 2021 7:30:47 AM<br>
<b>To:</b> Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Cc:</b> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>; Nieto, David M <David.Nieto@amd.com>; Alex Deucher <alexdeucher@gmail.com>; Intel Graphics Development <Intel-gfx@lists.freedesktop.org>; Maling list - DRI developers <dri-devel@lists.freedesktop.org>;
Daniel Vetter <daniel@ffwll.ch><br>
<b>Subject:</b> Re: [PATCH 0/7] Per client engine busyness</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Fri, May 14, 2021 at 05:10:29PM +0200, Christian König wrote:<br>
> Am 14.05.21 um 17:03 schrieb Tvrtko Ursulin:<br>
> > <br>
> > On 14/05/2021 15:56, Christian König wrote:<br>
> > > Am 14.05.21 um 16:47 schrieb Tvrtko Ursulin:<br>
> > > > <br>
> > > > On 14/05/2021 14:53, Christian König wrote:<br>
> > > > > > <br>
> > > > > > David also said that you considered sysfs but were wary<br>
> > > > > > of exposing process info in there. To clarify, my patch<br>
> > > > > > is not exposing sysfs entry per process, but one per<br>
> > > > > > open drm fd.<br>
> > > > > > <br>
> > > > > <br>
> > > > > Yes, we discussed this as well, but then rejected the approach.<br>
> > > > > <br>
> > > > > To have useful information related to the open drm fd you<br>
> > > > > need to related that to process(es) which have that file<br>
> > > > > descriptor open. Just tracking who opened it first like DRM<br>
> > > > > does is pretty useless on modern systems.<br>
> > > > <br>
> > > > We do update the pid/name for fds passed over unix sockets.<br>
> > > <br>
> > > Well I just double checked and that is not correct.<br>
> > > <br>
> > > Could be that i915 has some special code for that, but on my laptop<br>
> > > I only see the X server under the "clients" debugfs file.<br>
> > <br>
> > Yes we have special code in i915 for this. Part of this series we are<br>
> > discussing here.<br>
> <br>
> Ah, yeah you should mention that. Could we please separate that into common<br>
> code instead? Cause I really see that as a bug in the current handling<br>
> independent of the discussion here.<br>
> <br>
> As far as I know all IOCTLs go though some common place in DRM anyway.<br>
<br>
Yeah, might be good to fix that confusion in debugfs. But since that's<br>
non-uapi, I guess no one ever cared (enough).<br>
<br>
> > > > > But an "lsof /dev/dri/renderD128" for example does exactly<br>
> > > > > what top does as well, it iterates over /proc and sees which<br>
> > > > > process has that file open.<br>
> > > > <br>
> > > > Lsof is quite inefficient for this use case. It has to open<br>
> > > > _all_ open files for _all_ processes on the system to find a<br>
> > > > handful of ones which may have the DRM device open.<br>
> > > <br>
> > > Completely agree.<br>
> > > <br>
> > > The key point is you either need to have all references to an open<br>
> > > fd, or at least track whoever last used that fd.<br>
> > > <br>
> > > At least the last time I looked even the fs layer didn't know which<br>
> > > fd is open by which process. So there wasn't really any alternative<br>
> > > to the lsof approach.<br>
> > <br>
> > I asked you about the use case you have in mind which you did not<br>
> > answer. Otherwise I don't understand when do you need to walk all files.<br>
> > What information you want to get?<br>
> <br>
> Per fd debugging information, e.g. instead of the top use case you know<br>
> which process you want to look at.<br>
> <br>
> > <br>
> > For the use case of knowing which DRM file is using how much GPU time on<br>
> > engine X we do not need to walk all open files either with my sysfs<br>
> > approach or the proc approach from Chris. (In the former case we<br>
> > optionally aggregate by PID at presentation time, and in the latter case<br>
> > aggregation is implicit.)<br>
> <br>
> I'm unsure if we should go with the sysfs, proc or some completely different<br>
> approach.<br>
> <br>
> In general it would be nice to have a way to find all the fd references for<br>
> an open inode.<br>
<br>
Yeah, but that maybe needs to be an ioctl or syscall or something on the<br>
inode, that givey you a list of (procfd, fd_nr) pairs pointing back at all<br>
open files? If this really is a real world problem, but given that<br>
top/lsof and everyone else hasn't asked for it yet maybe it's not.<br>
<br>
Also I replied in some other thread, I really like the fdinfo stuff, and I<br>
think trying to somewhat standardized this across drivers would be neat.<br>
Especially since i915 is going to adopt drm/scheduler for front-end<br>
scheduling too, so at least some of this should be fairly easy to share.<br>
<br>
Cheers, Daniel<br>
-- <br>
Daniel Vetter<br>
Software Engineer, Intel Corporation<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7C3711fdd207484d6bb5fd08d919405eb0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637568586536251118%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=so13elRn0Ffl7w51QEk%2F%2FXmxOav9n5p6fNXrnDBVY%2B0%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7C3711fdd207484d6bb5fd08d919405eb0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637568586536251118%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=so13elRn0Ffl7w51QEk%2F%2FXmxOav9n5p6fNXrnDBVY%2B0%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>