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
Subject: [PATCH i-g-t v1 2/3] tests/intel/xe_pmu: Check if other processes are using the DRM device
Date: Mon, 30 Mar 2026 21:09:15 +0530	[thread overview]
Message-ID: <20260330153916.2474178-3-soham.purkait@intel.com> (raw)
In-Reply-To: <20260330153916.2474178-1-soham.purkait@intel.com>

If the engine accuracy test is run with other processes using the DRM
device, the GPU engine activity may be higher than expected. Which may
lead to false positives in the test, even if the engine activity is
reported correctly.
To help identify this issue, a check for other processes using the DRM
device is provided and a warning message is printed if any such processes
are found and the very test is skipped.

Signed-off-by: Soham Purkait <soham.purkait@intel.com>
---
 tests/intel/xe_pmu.c | 25 +++++++++++++++++++++++++
 tests/meson.build    |  1 +
 2 files changed, 26 insertions(+)

diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
index fb4b871e7..4dd610e8c 100644
--- a/tests/intel/xe_pmu.c
+++ b/tests/intel/xe_pmu.c
@@ -95,6 +95,7 @@
  */
 
 #include "igt.h"
+#include "igt_drm_clients.h"
 #include "igt_perf.h"
 #include "igt_sriov_device.h"
 #include "igt_sysfs.h"
@@ -507,6 +508,30 @@ static void accuracy(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t config, before[2], after[2];
 	int link[2], pmu_fd[2];
 	double engine_activity, expected;
+	unsigned long wait = 100000;
+	struct igt_drm_client_proc *procs = NULL;
+	int num_clients = 0;
+
+	/* Wait for other processes using the DRM device ends */
+	for (int pass = 0; pass < 50; pass++) {
+		if (!igt_drm_get_client_procs(fd, getpid(), NULL))
+			break;
+		usleep(wait);
+	}
+
+	num_clients = igt_drm_get_client_procs(fd, getpid(), &procs);
+
+	/* Check if still any process is 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, "
+			 "cannot ensure the reliability of this test.\n");
+	}
 
 	cycle_us = min_test_us / target_iter;
 	active_us = cycle_us * target_percentage / 100;
diff --git a/tests/meson.build b/tests/meson.build
index 79f21c018..d13598fdd 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -422,6 +422,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.43.0


  parent reply	other threads:[~2026-03-30 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 15:39 [PATCH i-g-t v1 0/3] tests/intel/xe_pmu: Guard engine accuracy tests against busy DRM clients Soham Purkait
2026-03-30 15:39 ` [PATCH i-g-t v1 1/3] lib/igt_drm_clients: Add helper to list and count the DRM client processes Soham Purkait
2026-03-30 15:39 ` Soham Purkait [this message]
2026-03-30 15:39 ` [PATCH i-g-t v1 3/3] HAX: Add engine accuracy tests to xe-fast-feedback.testlist Soham Purkait
2026-03-31  4:11 ` ✓ Xe.CI.BAT: success for tests/intel/xe_pmu: Guard engine accuracy tests against busy DRM clients Patchwork
2026-03-31  4:28 ` ✓ i915.CI.BAT: " Patchwork
2026-03-31  9:40 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-31 14:04 ` ✗ i915.CI.Full: failure " 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=20260330153916.2474178-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