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
Subject: [PATCH i-g-t 2/3] tests/intel/xe_pmu: Add check for the other drm clients using the device
Date: Thu, 2 Apr 2026 18:30:25 +0530 [thread overview]
Message-ID: <20260402130026.2687520-3-soham.purkait@intel.com> (raw)
In-Reply-To: <20260402130026.2687520-1-soham.purkait@intel.com>
If other processes are using the DRM device while idle residency test
is running, GPU engines may be in use, and idle residency might be lower
than expected leading to false positives.
To help identify this issue, a check for the DRM clients, except the very
test, is used and a warning message is printed if any such processes
are found and the test is skipped.
Signed-off-by: Soham Purkait <soham.purkait@intel.com>
---
tests/intel/xe_pmu.c | 27 +++++++++++++++++++++++++--
tests/meson.build | 1 +
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
index fb4b871e7..c907b6207 100644
--- a/tests/intel/xe_pmu.c
+++ b/tests/intel/xe_pmu.c
@@ -100,6 +100,7 @@
#include "igt_sysfs.h"
#include "xe/xe_gt.h"
+#include "igt_drm_clients.h"
#include "xe/xe_ioctl.h"
#include "xe/xe_spin.h"
#include "xe/xe_sriov_admin.h"
@@ -865,17 +866,39 @@ static void engine_activity_multi_client(int fd, struct drm_xe_engine_class_inst
static void test_gt_c6_idle(int xe, unsigned int gt)
{
- int pmu_fd;
+ int pmu_fd, num_clients = 0;
uint64_t pmu_config;
uint64_t ts[2];
- unsigned long slept, start, end;
+ unsigned long slept, start, end, wait = 100000;
uint64_t val;
+ struct igt_drm_client_proc *procs = NULL;
/* Get the PMU config for the gt-c6 event */
pmu_config = get_event_config(gt, NULL, "gt-c6-residency");
pmu_fd = open_pmu(xe, pmu_config);
+ /* Wait for other processes using the DRM device ends */
+ for (int pass = 0; pass < 50; pass++) {
+ if (!igt_drm_get_client_procs(xe, getpid(), NULL))
+ break;
+ usleep(wait);
+ }
+
+ num_clients = igt_drm_get_client_procs(xe, getpid(), &procs);
+
+ /* Check if any process is still using the DRM device */
+ if (num_clients) {
+ for (unsigned int i = 0; i < num_clients; i++) {
+ igt_warn("%s (pid=%u client=%lu) is using DRM device.\n",
+ procs[i].print_name, procs[i].pid, procs[i].id);
+ }
+ free(procs);
+ procs = NULL;
+ igt_skip("As other processes are using the DRM device, "
+ "measured idle_residency may be lower than expected.\n");
+ }
+
igt_require_f(igt_wait(xe_gt_is_in_c6(xe, gt), 1000, 10), "GT %d should be in C6\n", gt);
/* While idle check full RC6. */
diff --git a/tests/meson.build b/tests/meson.build
index 26d9345ec..e682ed9dd 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -425,6 +425,7 @@ extra_dependencies = {
'sw_sync': [ libatomic ],
'xe_fault_injection': [ lib_igt_xe_oa ],
'xe_oa': [ lib_igt_xe_oa ],
+ 'xe_pmu': [ lib_igt_drm_clients ],
'xe_compute': [ igt_deps,lib_igt_perf,lib_igt_profiling,math ],
}
--
2.34.1
next prev parent reply other threads:[~2026-04-02 13:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 13:00 [PATCH i-g-t 0/3] Guard gt-c6-idle test against busy DRM clients Soham Purkait
2026-04-02 13:00 ` [PATCH i-g-t 1/3] lib/igt_drm_clients: Add helper to list and count the DRM client processes Soham Purkait
2026-04-02 13:00 ` Soham Purkait [this message]
2026-04-02 13:00 ` [PATCH i-g-t 3/3] HAX: Add gt-c6-idle test to xe-fast-feedback.testlist Soham Purkait
2026-04-02 17:30 ` ✓ Xe.CI.BAT: success for Guard gt-c6-idle test against busy DRM clients Patchwork
2026-04-02 17:42 ` ✓ i915.CI.BAT: " Patchwork
2026-04-03 4:33 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-03 18:31 ` ✗ 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=20260402130026.2687520-3-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=riana.tauro@intel.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