[PATCH i-g-t 00/12] gputop: Add support for xe

Lucas De Marchi lucas.demarchi at intel.com
Fri Apr 5 06:00:44 UTC 2024


This contains all the patches I had pending for igt to add support for
gputop for the xe driver. This was added on top of
https://patchwork.freedesktop.org/series/131956/ (Refactors and fixes
for drm_clients). 2 patches from that series are posted again here
with one of those pending review.

I decided to remove the patch "lib/igt_drm_clients: lazy stat process"
to focus on adding the xe support rather than optimizing.

Patches 3-6 are more minor fixes and refactors to prepare for the new
feature.

Patches 7-9 add support for a new "ticks" unit to the libraries when
parsing the fdinfo

Patches 10-11 are minor refactors to gputop

Last patch plumbs the changes together to implement the new way to
calculate the percentage. This is considered an RFC only as I still have
to send the kernel side. It's a good opportunity to see how
we plan to use it, give feedback about the new unit and the
motivation behind it.

WARNING: the only thing tested here is that I didn't break the old
format:  gputop with i915 continues to work for me after these changes.
For the kernel side I have to get some patches prepared by Umesh, add a
few more from me and give some proper rounds of testing.

One thing I noticed is that if we were to just add the new format to
fdinfo, we'd break gputop. That is because gputop was not parsing the
complete line and didn't check the unit. I checked 2 other
implementations I found for gputop-like sw and they didn't have this
problem:

	- nvtop: https://github.com/Syllo/nvtop/blob/master/src/extract_gpuinfo_intel.c
	- htop: https://github.com/htop-dev/htop/blob/main/linux/GPU.c

So I think we may be safe to add the new unit as used here and not break
anything other than our own toy (but fixed in this series).

Lucas De Marchi (12):
  lib/igt_drm_fdinfo: Stop passing key twice
  lib/igt_drm_fdinfo: Remove prefix arg from parse functions
  lib/igt_drm_fdinfo: Fix wrong name len assert
  lib/igt_drm_fdinfo: Assert pdev is not truncated
  lib/igt_drm_fdinfo: Detect invalid drm-client-id
  lib/igt_drm_fdinfo: Stop ignoring space where not needed
  lib/igt_drm_fdinfo: Parse unit for engine utilization
  lib/igt_drm_fdinfo: Store 2 counters for "ticks" unit
  lib/igt_drm_clients: Store second data for ticks busyness
  gputop: Extract method to update console size
  gputop: Extract clrscr()
  RFC: gputop: Add support for ticks unit

 lib/igt_drm_clients.c |  24 ++++--
 lib/igt_drm_clients.h |   3 +
 lib/igt_drm_fdinfo.c  | 185 +++++++++++++++++++++++-------------------
 lib/igt_drm_fdinfo.h  |   7 ++
 tools/gputop.c        |  44 ++++++----
 5 files changed, 162 insertions(+), 101 deletions(-)

-- 
2.44.0



More information about the igt-dev mailing list