public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Soham Purkait <soham.purkait@intel.com>
To: igt-dev@lists.freedesktop.org, riana.tauro@intel.com,
	badal.nilawar@intel.com, kamil.konieczny@intel.com,
	vinay.belgaumkar@intel.com
Cc: anshuman.gupta@intel.com, soham.purkait@intel.com,
	tvrtko.ursulin@igalia.com, tursulin@ursulin.net,
	lucas.de.marchi@gmail.com
Subject: [PATCH i-g-t v10 0/5] Close any open drm device after engine initialization in GPUTOP
Date: Mon,  6 Apr 2026 11:34:23 +0530	[thread overview]
Message-ID: <20260406060428.2734117-1-soham.purkait@intel.com> (raw)

       During engine initialization for a specific device, the helper
functions require an open card_fd to query engines and configurations
needed to compute engine busyness via PMU. However, KMS tests require
that no other DRM client be active, and keeping card_fd open causes
gputop to appear as a DRM client. Therefore, card_fd is closed immediately
after discovery.
     Additionally, this patch removes the lib/xe/* dependency and perform
engine discovery using direct ioctl calls, simplifying the implementation
and reducing external dependencies, while also providing a fallback to
report only client busyness when engine busyness counters are not
accessible to non-root users.

   GPUTOP engine busyness is also capable of running without superuser
access through setting CAP_PERFMON or an appropriate perf_event_paranoid
setting, Otherwise user could continue with only GPU client busyness if
required.

Steps to enable engine busyness to run without root (using CAP_PERFMON):
$ cd /path/to/igt-gpu-tools/
$ sudo setcap cap_perfmon=+ep $(pwd)/build/tools/gputop
$ sudo sh -c "echo $(pwd)/build/lib > /etc/ld.so.conf.d/lib-igt.conf"
$ sudo ldconfig
Steps to revert once done:
$ sudo setcap cap_perfmon=-ep $(pwd)/build/tools/gputop
$ sudo rm /etc/ld.so.conf.d/lib-igt.conf
$ sudo ldconfig

Steps to enable engine busyness to run without root (using perf_event_paranoid):
# Save current value
$ orig_val=$(sysctl -n kernel.perf_event_paranoid)
# Set the value to allow running GPUTOP without root privileges
$ sudo sysctl -w kernel.perf_event_paranoid=-1
Steps to revert once done:
$ sudo sysctl -w kernel.perf_event_paranoid=$orig_val

Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Kamil Konieczny <kamil.konieczny@intel.com>
Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>

Soham Purkait (5):
  tools: Rename tools/gputop to tools/gputop.src
  tools/gputop.src/utils: Add clamp macro to remove dependency on
    lib/xe/*
  tools/gputop.src/xe_gputop: Use direct ioctls with card_fd cleanup
  tools/gputop.src/gputop: Add support for per-engine busyness
    monitoring
  tools/gputop.src/gputop: Add command line option for device filter

 tools/{ => gputop.src}/gputop.c          | 311 ++++++++++++++++++++---
 tools/gputop.src/meson.build             |   1 +
 tools/{gputop => gputop.src}/utils.c     |   0
 tools/{gputop => gputop.src}/utils.h     |  15 +-
 tools/{gputop => gputop.src}/xe_gputop.c | 150 ++++++++---
 tools/{gputop => gputop.src}/xe_gputop.h |   8 +-
 tools/meson.build                        |  12 +-
 7 files changed, 407 insertions(+), 90 deletions(-)
 rename tools/{ => gputop.src}/gputop.c (65%)
 create mode 100644 tools/gputop.src/meson.build
 rename tools/{gputop => gputop.src}/utils.c (100%)
 rename tools/{gputop => gputop.src}/utils.h (84%)
 rename tools/{gputop => gputop.src}/xe_gputop.c (74%)
 rename tools/{gputop => gputop.src}/xe_gputop.h (86%)

-- 
2.34.1


             reply	other threads:[~2026-04-06  6:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-06  6:04 Soham Purkait [this message]
2026-04-06  6:04 ` [PATCH i-g-t v10 1/5] tools: Rename tools/gputop to tools/gputop.src Soham Purkait
2026-04-07  7:45   ` Jani Nikula
2026-04-08  5:50     ` Purkait, Soham
2026-04-06  6:04 ` [PATCH i-g-t v10 2/5] tools/gputop.src/utils: Add clamp macro to remove dependency on lib/xe/* Soham Purkait
2026-04-06  6:04 ` [PATCH i-g-t v10 3/5] tools/gputop.src/xe_gputop: Use direct ioctls with card_fd cleanup Soham Purkait
2026-04-06  6:04 ` [PATCH i-g-t v10 4/5] tools/gputop.src/gputop: Add support for per-engine busyness monitoring Soham Purkait
2026-04-06  9:04   ` Tvrtko Ursulin
2026-04-08  7:50     ` Purkait, Soham
2026-04-09  8:52       ` Tvrtko Ursulin
2026-04-06  6:04 ` [PATCH i-g-t v10 5/5] tools/gputop.src/gputop: Add command line option for device filter Soham Purkait
2026-04-06  8:25 ` ✓ Xe.CI.BAT: success for Close any open drm device after engine initialization in GPUTOP (rev11) Patchwork
2026-04-06  8:42 ` ✓ i915.CI.BAT: " Patchwork
2026-04-06 11:21 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-06 12:32 ` ✗ i915.CI.Full: " Patchwork

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=20260406060428.2734117-1-soham.purkait@intel.com \
    --to=soham.purkait@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@intel.com \
    --cc=lucas.de.marchi@gmail.com \
    --cc=riana.tauro@intel.com \
    --cc=tursulin@ursulin.net \
    --cc=tvrtko.ursulin@igalia.com \
    --cc=vinay.belgaumkar@intel.com \
    /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